From 1e24b22ef4bf07746ce57eee5aaa1c6bed6de131 Mon Sep 17 00:00:00 2001 From: roytam1 Date: Fri, 21 May 2021 09:14:47 +0800 Subject: [PATCH] remove nsINetUtil_ESR_38, fixup and import changes from `dev' branch of rmottola/Arctic-Fox: - Bug 1150366 - Remove duplicate d3.js. r=jsantell (71f991da6) - Bug 1175352 - Refactor LoadInfo arguments to be more self contained (r=bent) (3f7d08164) - Bug 1181533 - Add nsCRTGlue.h and prtime.h includes to nsDownloadManager.cpp to fix --disable-safe-browsing build bustage. r=froydnj (af338edf1) - Bug 905127 - Part 1 - Make some functions from nsNetUtil not inline. r=jduell Bug 905127 - Part 2 - remove unnecessary nsNetUtil.h includes r=jduell Bug 905127 - Make some functions from nsNetUtil not inline. r=jduell (bc47d5b3a) - Bug 1117650 - Part 1: Move all CORS tests into dom/security/test. r=sicking (6f727387c) - Bug 1117650 - Part 2: Move all MixedContent tests into dom/security/test. r=tanvi (73f273829) - Bug 1004703 - ignore 'unsafe-inline' if nonce- or hash-source specifed - tests (r=sstamm) (ebf411159) - Bug 921493 - CSP: test whitelisting of scheme-relative sources (r=dveditz) (f0618b189) - Bug 1139569 - Optimize update function for element editors in markup view;r=mratcliffe (c60d38dca) - Partil of Bug 1139644 - Make markupview use sdk timers instead of individual timers for each window;r=pbrosset (8bc1a4d66) - Bug 1146568 - Avoid unsafe CPOW usage warnings in browser_markupview_tag_edit_08.js; r=bgrins Making use of the devtools test frame-script to set the test node's attributes instead of using a CPOW. (61d7eed64) - Bug 1146568 - Avoid unsafe CPOW usage in markupview tests, in assertAttributes helper; r=bgrins (efc492d5d) - Bug 858038 - Allow moving elements in the markupview by drag/drop; r=pbrosset (51d79c15c) - Bug 1139644 - Flash only relevant attributes in markup view when changed;r=pbrosset (29807fa46) - Bug 1147128 - Make sure attribute shows up in markup view after removing and setting to the previous value;r=mratcliffe (1947f7417) - Bug 1147325 - Clear box model timer on markup view destroy. r=pbrosset Prevents 'this._inspector.toolbox is null' spam in mochitest-dt (1d6808b4a) - Bug 921102 - 1 - Linkify URIs in the inspector; r=tromey, miker This first part adds a parser for node attributes which, given some node information and an attribute name, generates a small AST-like array of objects that tells which parts of the attribute (if any) are links, and what they link to. Using this, the markup-view generates the right HTML structure to display these parts as links. This part 1 doesn't yet allow users to follow these links. (c500e270e) - Bug 1139667 - CSP tests for fetch(). r=ckirschb (df030457f) - Bug 1086999 - CSP: Asterisk (*) wildcard should not allow blob:, data:, or filesystem: when matching source expressions - tests (r=sstamm) (dee0f2239) - Bug 1117650 - Part 3: Move all CSP tests into dom/security/test. r=sstamm (29c95475c) - Bug 1146566 - 1 - Use devtools common frame-script in markupview tests and add helper; r=bgrins (b10e42468) - Bug 1146566 - 2 - Avoid using CPOWs in test browser_markupview_tag_edit_03.js; r=bgrins This change updates the browser_markupview_tag_edit_03.js test by making use of the getDomElementInfo message listener to retrieve information about the tested nodes without having to go through CPOWs. (07f0ee3ff) - Bug 1036324 - Adds option to walker.parents() to not traverse DocShellTreeItems of different types (24123a5d2) - Bug 921102 - 2 - Markup-view tests for attribute links; r=miker (f6da81799) - Bug 901250 - Add scroll into view menu item for the inspector. r=bgrins (bfc7518b1) - Bug 994055 - Part 1: Add a toggle sidebar panel button to the inspector. r=miker This adds a new icon, next to the searchbox (like in the debugger) to expand or collapse the sidebar panel in the inspector. The state is *not* persisted yet when the toolbox is closed. The button is hidden when the toolbox host switches to 'side'. (87730e20a) - Bug 994055 - Part 2: Add tests for the inspector sidebar toggle button. r=miker (2872c3fbd) - Bug 921102 - 3 - Open/copy markup-view attribute links; r=bgrins This part adds contextual menu items that become enabled when the user right clicks on an attribute that has a link. Depending on the nature of the link, a new tab will be opened or a node selected. The user can also choose to copy the link in the clipboard. (9b93485f6) - Bug 921102 - 4 - Tests for the open/copy links on markup-view attributes; r=bgrins (861ba51f6) --- accessible/generic/Accessible.cpp | 1 - browser/components/about/AboutRedirector.cpp | 2 + .../migration/nsIEHistoryEnumerator.cpp | 1 + .../components/shell/nsGNOMEShellService.cpp | 3 +- .../components/shell/nsMacShellService.cpp | 3 +- .../shell/nsWindowsShellService.cpp | 1 + caps/BasePrincipal.cpp | 1 + caps/nsNullPrincipal.cpp | 2 +- caps/nsNullPrincipalURI.cpp | 1 - caps/nsPrincipal.cpp | 2 + chrome/nsChromeProtocolHandler.cpp | 2 + docshell/base/SerializedLoadContext.cpp | 1 + docshell/base/nsDefaultURIFixup.cpp | 2 + docshell/base/nsDocShell.cpp | 7 + dom/archivereader/ArchiveReader.cpp | 2 +- dom/base/Element.cpp | 1 - dom/base/EventSource.cpp | 3 + dom/base/ImageEncoder.cpp | 1 + dom/base/ImageEncoder.h | 1 - dom/base/Navigator.cpp | 3 + dom/base/ResponsiveImageSelector.cpp | 1 - dom/base/ThirdPartyUtil.cpp | 2 + dom/base/WebSocket.cpp | 2 + dom/base/nsContentSink.cpp | 2 + dom/base/nsContentUtils.cpp | 2 + dom/base/nsDOMDataChannel.cpp | 1 - dom/base/nsDOMFileReader.cpp | 1 - dom/base/nsDataDocumentContentPolicy.cpp | 1 + dom/base/nsDocument.cpp | 5 +- dom/base/nsGlobalWindow.cpp | 2 + dom/base/nsINode.cpp | 1 - dom/base/nsInProcessTabChildGlobal.cpp | 1 - dom/base/nsJSEnvironment.cpp | 1 - dom/base/nsObjectLoadingContent.cpp | 1 + dom/base/nsStyleLinkElement.cpp | 1 - dom/base/nsXMLHttpRequest.cpp | 6 + dom/base/test/csp/chrome.ini | 5 - dom/base/test/csp/file_CSP_web_manifest.html | 6 - .../test/csp/file_CSP_web_manifest_https.html | 4 - .../test/csp/file_bug836922_npolicies.html | 15 - dom/base/test/csp/file_bug886164.html | 15 - dom/base/test/csp/file_bug886164_3.html | 12 - dom/base/test/csp/file_bug886164_4.html | 12 - .../csp/file_csp_allow_https_schemes.html | 14 - dom/base/test/csp/file_csp_bug768029.html | 25 - dom/base/test/csp/file_csp_bug773891.html | 25 - ..._regression_from_multipolicy.html^headers^ | 1 - .../test/mixedcontentblocker/mochitest.ini | 20 - dom/base/test/mochitest.ini | 9 - dom/base/test/moz.build | 5 - ...arning_for_blocked_cross_site_request.html | 4 +- dom/base/test/unit/xpcshell.ini | 2 - dom/cache/Cache.cpp | 1 - dom/cache/DBAction.cpp | 2 +- dom/cache/DBSchema.cpp | 1 + dom/cache/FileUtils.cpp | 3 +- dom/camera/TestGonkCameraHardware.cpp | 2 +- dom/devicestorage/nsDeviceStorage.cpp | 1 + dom/fetch/FetchDriver.cpp | 2 + dom/filehandle/FileHandle.cpp | 1 + dom/filesystem/CreateFileTask.cpp | 1 + dom/filesystem/FileSystemTaskBase.cpp | 2 +- dom/html/HTMLFormElement.cpp | 1 + dom/html/HTMLImageElement.cpp | 1 - dom/html/HTMLInputElement.cpp | 1 + dom/html/HTMLLinkElement.cpp | 1 - dom/html/HTMLStyleElement.cpp | 1 - dom/html/HTMLVideoElement.cpp | 1 - dom/html/nsGenericHTMLElement.cpp | 1 - dom/html/nsHTMLContentSink.cpp | 1 - dom/html/nsHTMLDNSPrefetch.cpp | 2 + dom/html/nsHTMLDocument.cpp | 1 + dom/indexedDB/ActorsParent.cpp | 1 + dom/ipc/ContentParent.cpp | 1 + dom/ipc/TabParent.cpp | 1 + dom/json/nsJSON.cpp | 2 + dom/jsurl/nsJSProtocolHandler.cpp | 1 + dom/media/MediaManager.cpp | 1 + dom/media/systemservices/LoadManager.cpp | 1 - dom/media/systemservices/LoadMonitor.cpp | 2 + dom/media/systemservices/MediaParent.cpp | 3 + dom/media/webaudio/AudioContext.cpp | 1 + dom/network/TCPServerSocketParent.cpp | 1 + dom/network/TCPSocketParent.cpp | 1 + dom/offline/nsDOMOfflineResourceList.cpp | 2 + dom/plugins/base/nsNPAPIPlugin.cpp | 1 + dom/plugins/base/nsPluginHost.cpp | 3 + dom/security/moz.build | 2 + dom/security/nsCORSListenerProxy.cpp | 2 + dom/security/nsCSPContext.h | 2 +- dom/security/nsCSPUtils.cpp | 2 +- dom/security/nsMixedContentBlocker.cpp | 1 - dom/{base => security}/test/TestCSPParser.cpp | 0 .../cors}/file_CrossSiteXHR_cache_server.sjs | 4 +- .../test/cors}/file_CrossSiteXHR_inner.html | 0 .../test/cors}/file_CrossSiteXHR_inner.jar | Bin .../cors}/file_CrossSiteXHR_inner_data.sjs | 0 .../test/cors}/file_CrossSiteXHR_server.sjs | 2 +- dom/security/test/cors/mochitest.ini | 12 + .../test/cors}/test_CrossSiteXHR.html | 6 +- .../test/cors}/test_CrossSiteXHR_cache.html | 4 +- .../test/cors}/test_CrossSiteXHR_origin.html | 8 +- dom/{base => security}/test/csp/browser.ini | 0 .../test/csp/browser_test_web_manifest.js | 12 +- ...browser_test_web_manifest_mixed_content.js | 8 +- dom/security/test/csp/chrome.ini | 5 + dom/{base => security}/test/csp/file_CSP.css | 2 +- dom/{base => security}/test/csp/file_CSP.sjs | 0 .../test/csp/file_allow_https_schemes.html | 14 + .../test/csp/file_base-uri.html | 0 .../test/csp/file_blob_data_schemes.html | 49 + .../test/csp/file_bug663567.xsl} | 0 .../test/csp/file_bug663567_allows.xml} | 2 +- .../csp/file_bug663567_allows.xml^headers^} | 0 .../test/csp/file_bug663567_blocks.xml} | 2 +- .../csp/file_bug663567_blocks.xml^headers^} | 0 dom/security/test/csp/file_bug768029.html | 25 + .../test/csp/file_bug768029.sjs} | 0 dom/security/test/csp/file_bug773891.html | 25 + .../test/csp/file_bug773891.sjs} | 0 .../test/csp/file_bug802872.html} | 2 +- .../test/csp/file_bug802872.html^headers^} | 0 .../test/csp/file_bug802872.js} | 4 +- .../test/csp/file_bug802872.sjs} | 0 .../test/csp/file_bug836922_npolicies.html | 15 + .../file_bug836922_npolicies.html^headers^ | 4 +- .../file_bug836922_npolicies_ro_violation.sjs | 0 .../file_bug836922_npolicies_violation.sjs | 0 .../test/csp/file_bug885433_allows.html} | 0 .../csp/file_bug885433_allows.html^headers^} | 0 .../test/csp/file_bug885433_blocks.html} | 0 .../csp/file_bug885433_blocks.html^headers^} | 0 dom/security/test/csp/file_bug886164.html | 15 + .../test/csp/file_bug886164.html^headers^ | 0 .../test/csp/file_bug886164_2.html | 4 +- .../test/csp/file_bug886164_2.html^headers^ | 0 dom/security/test/csp/file_bug886164_3.html | 12 + .../test/csp/file_bug886164_3.html^headers^ | 0 dom/security/test/csp/file_bug886164_4.html | 12 + .../test/csp/file_bug886164_4.html^headers^ | 0 .../test/csp/file_bug886164_5.html | 8 +- .../test/csp/file_bug886164_5.html^headers^ | 0 .../test/csp/file_bug886164_6.html | 4 +- .../test/csp/file_bug886164_6.html^headers^ | 0 .../test/csp/file_bug888172.html} | 0 .../test/csp/file_bug888172.sjs} | 2 +- .../test/csp/file_bug909029_none.html} | 0 .../csp/file_bug909029_none.html^headers^} | 0 .../test/csp/file_bug909029_star.html} | 0 .../csp/file_bug909029_star.html^headers^} | 0 .../test/csp/file_bug910139.sjs} | 4 +- .../test/csp/file_bug910139.xml} | 2 +- .../test/csp/file_bug910139.xsl} | 0 .../test/csp/file_bug941404.html} | 6 +- .../test/csp/file_bug941404_xhr.html} | 0 .../csp/file_bug941404_xhr.html^headers^} | 0 .../test/csp/file_connect-src-fetch.html | 16 + .../test/csp/file_connect-src.html | 4 +- .../test/csp/file_evalscript_main.html} | 2 +- .../csp/file_evalscript_main.html^headers^} | 0 .../test/csp/file_evalscript_main.js} | 0 .../csp/file_evalscript_main_allowed.html} | 2 +- ...ile_evalscript_main_allowed.html^headers^} | 0 .../test/csp/file_evalscript_main_allowed.js} | 0 .../test/csp/file_form-action.html | 0 .../test/csp/file_frameancestors.sjs} | 4 +- .../test/csp/file_frameancestors_main.html} | 2 +- .../test/csp/file_frameancestors_main.js} | 6 +- .../test/csp/file_hash_source.html | 0 .../test/csp/file_hash_source.html^headers^ | 0 .../test/csp/file_ignore_unsafe_inline.html | 26 + .../test/csp/file_inlinescript_main.html} | 0 .../csp/file_inlinescript_main.html^headers^} | 0 .../csp/file_inlinescript_main_allowed.html} | 0 ...e_inlinescript_main_allowed.html^headers^} | 0 .../test/csp/file_inlinestyle_main.html} | 0 .../csp/file_inlinestyle_main.html^headers^} | 0 .../csp/file_inlinestyle_main_allowed.html} | 0 ...le_inlinestyle_main_allowed.html^headers^} | 0 .../csp/file_invalid_source_expression.html} | 4 +- .../test/csp/file_leading_wildcard.html | 4 +- .../test/csp/file_main.html} | 18 +- .../test/csp/file_main.html^headers^} | 0 .../test/csp/file_main.js} | 4 +- .../file_multi_policy_injection_bypass.html | 4 +- ...ulti_policy_injection_bypass.html^headers^ | 0 .../file_multi_policy_injection_bypass_2.html | 4 +- ...ti_policy_injection_bypass_2.html^headers^ | 0 .../test/csp/file_nonce_source.html | 10 +- .../test/csp/file_nonce_source.html^headers^ | 0 .../test/csp/file_null_baseuri.html | 0 .../test/csp/file_path_matching.html} | 2 +- .../test/csp/file_path_matching.js} | 0 .../csp/file_path_matching_incl_query.html} | 2 +- .../csp/file_path_matching_redirect.html} | 2 +- .../file_path_matching_redirect_server.sjs} | 2 +- ...policyuri_regression_from_multipolicy.html | 0 ..._regression_from_multipolicy.html^headers^ | 1 + ...licyuri_regression_from_multipolicy_policy | 0 .../test/csp/file_redirect_content.sjs | 2 +- .../test/csp/file_redirect_report.sjs | 0 .../test/csp/file_redirects_main.html} | 2 +- .../test/csp/file_redirects_page.sjs} | 2 +- .../test/csp/file_redirects_resource.sjs} | 2 +- .../test/csp/file_referrerdirective.html} | 6 +- .../test/csp/file_report.html} | 0 ...ort_uri_missing_in_report_only_header.html | 0 ...issing_in_report_only_header.html^headers^ | 0 .../test/csp/file_scheme_relative_sources.js | 1 + .../test/csp/file_scheme_relative_sources.sjs | 42 + .../file_self_none_as_hostname_confusion.html | 0 ...f_none_as_hostname_confusion.html^headers^ | 0 .../csp/file_subframe_run_js_if_allowed.html | 0 ...e_subframe_run_js_if_allowed.html^headers^ | 0 .../test/csp/file_testserver.sjs} | 0 dom/security/test/csp/file_web_manifest.html | 6 + .../test/csp/file_web_manifest.json} | 0 .../test/csp/file_web_manifest.json^headers^} | 0 .../test/csp/file_web_manifest_https.html | 4 + .../test/csp/file_web_manifest_https.json} | 0 .../csp/file_web_manifest_mixed_content.html} | 2 +- .../test/csp/file_web_manifest_remote.html} | 2 +- .../test/csp/file_worker_redirect.html | 0 .../test/csp/file_worker_redirect.sjs | 2 +- dom/{base => security}/test/csp/mochitest.ini | 183 +- .../test/csp/referrerdirective.sjs | 2 +- .../test/csp/test_301_redirect.html | 0 .../test/csp/test_302_redirect.html | 0 .../test/csp/test_303_redirect.html | 0 .../test/csp/test_307_redirect.html | 0 dom/{base => security}/test/csp/test_CSP.html | 2 +- .../test/csp/test_allow_https_schemes.html} | 6 +- .../test/csp/test_base-uri.html | 4 +- .../test/csp/test_blob_data_schemes.html | 89 + .../test/csp/test_bug663567.html} | 8 +- .../test/csp/test_bug768029.html} | 8 +- .../test/csp/test_bug773891.html} | 8 +- .../test/csp/test_bug802872.html} | 2 +- .../test/csp/test_bug836922_npolicies.html | 2 +- .../test/csp/test_bug885433.html} | 4 +- .../test/csp/test_bug886164.html | 2 +- .../test/csp/test_bug888172.html} | 6 +- .../test/csp/test_bug909029.html} | 4 +- .../test/csp/test_bug910139.html} | 8 +- .../test/csp/test_bug941404.html} | 4 +- .../test/csp/test_bug949549.html | 0 .../test/csp/test_connect-src.html | 34 +- .../test/csp/test_evalscript.html} | 4 +- .../test/csp/test_form-action.html | 4 +- .../test/csp/test_frameancestors.html} | 4 +- .../test/csp/test_hash_source.html | 0 .../test/csp/test_ignore_unsafe_inline.html | 110 + .../test/csp/test_inlinescript.html} | 4 +- .../test/csp/test_inlinestyle.html} | 4 +- .../csp/test_invalid_source_expression.html} | 4 +- .../test/csp/test_leading_wildcard.html | 4 +- .../test_multi_policy_injection_bypass.html | 2 +- .../test/csp/test_nonce_source.html | 0 .../test/csp/test_null_baseuri.html | 4 +- .../test/csp/test_path_matching.html} | 44 +- .../csp/test_path_matching_redirect.html} | 12 +- ...policyuri_regression_from_multipolicy.html | 0 .../test/csp/test_redirects.html} | 4 +- .../test/csp/test_referrerdirective.html} | 4 +- .../test/csp/test_report.html} | 10 +- ...ort_uri_missing_in_report_only_header.html | 0 .../csp/test_scheme_relative_sources.html | 91 + .../test_self_none_as_hostname_confusion.html | 0 .../csp/test_subframe_run_js_if_allowed.html | 0 .../test/csp/test_worker_redirect.html | 4 +- .../file_bug803225_test_mailto.html} | 0 .../file_frameNavigation.html} | 6 +- .../file_frameNavigation_blankTarget.html} | 2 +- .../file_frameNavigation_grandchild.html} | 4 +- .../file_frameNavigation_innermost.html} | 8 +- .../file_frameNavigation_secure.html} | 6 +- ...le_frameNavigation_secure_grandchild.html} | 4 +- .../test/mixedcontentblocker/file_main.html} | 2 +- .../file_main_bug803225.html} | 4 +- .../file_main_bug803225_websocket_wsh.py} | 0 .../test/mixedcontentblocker/file_server.sjs} | 0 .../test/mixedcontentblocker/mochitest.ini | 20 + .../mixedcontentblocker/test_bug803225.html} | 4 +- .../test_frameNavigation.html} | 6 +- .../test/mixedcontentblocker/test_main.html} | 2 +- dom/security/test/moz.build | 27 + .../test/unit/test_csp_reports.js} | 1 + dom/security/test/unit/xpcshell.ini | 7 + dom/storage/DOMStorageManager.cpp | 2 + dom/svg/nsSVGFilters.cpp | 1 - dom/telephony/Telephony.cpp | 1 - dom/tests/mochitest/fetch/test_fetch_cors.js | 2 +- dom/wifi/WifiCertService.cpp | 1 + dom/workers/RuntimeService.cpp | 1 - dom/workers/ScriptLoader.cpp | 2 + dom/workers/ServiceWorkerManager.cpp | 1 + dom/workers/ServiceWorkerRegistrar.cpp | 1 + dom/workers/ServiceWorkerScriptCache.cpp | 1 + .../test/serviceworkers/fetch/fetch_tests.js | 6 +- .../test/serviceworkers/fetch_event_worker.js | 6 +- dom/xbl/nsBindingManager.cpp | 1 - dom/xbl/nsXBLBinding.cpp | 1 - dom/xml/nsXMLFragmentContentSink.cpp | 1 - dom/xslt/xml/txXMLParser.cpp | 1 + dom/xslt/xslt/txMozillaTextOutput.cpp | 1 - dom/xslt/xslt/txMozillaXMLOutput.cpp | 1 - dom/xslt/xslt/txMozillaXSLTProcessor.cpp | 1 - dom/xul/nsXULPrototypeCache.cpp | 1 - dom/xul/templates/nsXULContentUtils.cpp | 1 - .../webbrowserpersist/nsWebBrowserPersist.cpp | 3 + .../windowwatcher/nsWindowWatcher.cpp | 4 + extensions/cookie/nsCookiePermission.cpp | 3 + extensions/cookie/nsPermissionManager.cpp | 1 + extensions/gio/nsGIOProtocolHandler.cpp | 9 + .../pref/autoconfig/src/nsAutoConfig.cpp | 2 + extensions/pref/autoconfig/src/nsAutoConfig.h | 3 +- .../spellcheck/src/mozPersonalDictionary.cpp | 6 + gfx/thebes/gfxFT2FontList.cpp | 1 - image/decoders/icon/android/nsIconChannel.cpp | 1 + image/decoders/icon/gtk/nsIconChannel.cpp | 5 + image/decoders/icon/mac/nsIconChannelCocoa.mm | 4 +- image/decoders/icon/nsIconURI.cpp | 1 - image/decoders/icon/win/nsIconChannel.cpp | 4 +- image/imgLoader.cpp | 5 + image/imgRequestProxy.cpp | 1 - intl/hyphenation/hnjstdio.cpp | 2 + intl/strres/nsStringBundle.cpp | 4 + intl/strres/nsStringBundleTextOverride.cpp | 1 + ipc/glue/BackgroundParentImpl.cpp | 1 + ipc/glue/BackgroundUtils.cpp | 63 + ipc/glue/BackgroundUtils.h | 20 + ipc/glue/URIUtils.cpp | 1 - js/xpconnect/src/XPCComponents.cpp | 1 + js/xpconnect/src/XPCJSRuntime.cpp | 1 + js/xpconnect/src/xpcprivate.h | 1 - layout/base/nsStyleSheetService.cpp | 1 + layout/generic/nsImageFrame.cpp | 1 + layout/generic/nsTextRunTransformations.cpp | 1 - layout/mathml/nsMathMLOperators.cpp | 2 +- layout/style/FontFaceSet.cpp | 2 + layout/style/Loader.cpp | 1 + .../layout-debug/src/nsRegressionTester.cpp | 1 - layout/xul/nsImageBoxFrame.cpp | 1 - layout/xul/tree/nsTreeBodyFrame.cpp | 1 - .../src/peerconnection/PeerConnectionImpl.cpp | 1 + .../peerconnection/PeerConnectionMedia.cpp | 2 + modules/libjar/nsJARInputStream.cpp | 1 - modules/libjar/zipwriter/nsZipWriter.cpp | 2 + modules/libpref/Preferences.cpp | 3 + netwerk/base/EventTokenBucket.cpp | 2 +- netwerk/base/LoadContextInfo.cpp | 1 - netwerk/base/LoadInfo.h | 17 +- netwerk/base/PrivateBrowsingChannel.h | 1 + netwerk/base/moz.build | 2 +- netwerk/base/nsAsyncStreamCopier.cpp | 3 + netwerk/base/nsBaseChannel.cpp | 5 +- netwerk/base/nsBaseChannel.h | 1 - netwerk/base/nsChannelClassifier.cpp | 2 +- netwerk/base/nsINetUtil.idl | 33 +- netwerk/base/nsINetUtil_ESR_38.idl | 14 - netwerk/base/nsIOService.cpp | 10 +- netwerk/base/nsIOService.h | 3 - netwerk/base/nsNetUtil.cpp | 2147 ++++++++++++- netwerk/base/nsNetUtil.h | 2736 +++-------------- netwerk/base/nsNetUtil.inl | 352 +++ netwerk/base/nsSimpleNestedURI.cpp | 1 - netwerk/build/nsNetModule.cpp | 1 - netwerk/cache/nsApplicationCacheService.cpp | 2 + netwerk/cache/nsDiskCacheDeviceSQL.cpp | 1 + netwerk/cookie/CookieServiceChild.cpp | 2 +- netwerk/cookie/CookieServiceParent.cpp | 2 +- netwerk/cookie/nsCookieService.cpp | 3 + netwerk/cookie/nsCookieService.h | 1 + netwerk/dns/ChildDNSService.cpp | 2 +- netwerk/dns/nsEffectiveTLDService.cpp | 3 + netwerk/ipc/NeckoChannelParams.ipdlh | 46 +- netwerk/ipc/NeckoChild.cpp | 1 + netwerk/ipc/NeckoParent.h | 2 + netwerk/ipc/RemoteOpenFileChild.cpp | 1 + netwerk/protocol/about/nsAboutCache.cpp | 1 + netwerk/protocol/app/AppProtocolHandler.cpp | 2 + netwerk/protocol/data/DataChannelParent.cpp | 1 + netwerk/protocol/data/nsDataHandler.cpp | 1 + netwerk/protocol/file/nsFileChannel.cpp | 6 + netwerk/protocol/ftp/FTPChannelChild.cpp | 40 +- netwerk/protocol/ftp/FTPChannelParent.cpp | 28 +- netwerk/protocol/ftp/FTPChannelParent.h | 9 +- .../protocol/ftp/nsFtpConnectionThread.cpp | 2 + .../protocol/http/ConnectionDiagnostics.cpp | 1 + netwerk/protocol/http/HttpBaseChannel.cpp | 1 + netwerk/protocol/http/HttpChannelChild.cpp | 40 +- netwerk/protocol/http/HttpChannelParent.cpp | 34 +- netwerk/protocol/http/HttpChannelParent.h | 8 +- netwerk/protocol/http/PHttpChannelParams.h | 1 - netwerk/protocol/http/TunnelUtils.cpp | 3 + netwerk/protocol/http/nsHttpChannel.cpp | 3 + netwerk/protocol/http/nsHttpChannel.h | 2 + .../http/nsHttpChannelAuthProvider.cpp | 3 + netwerk/protocol/http/nsHttpConnectionMgr.cpp | 1 + netwerk/protocol/http/nsHttpHandler.cpp | 3 +- netwerk/protocol/http/nsHttpResponseHead.cpp | 1 + netwerk/protocol/http/nsHttpTransaction.cpp | 3 + netwerk/protocol/res/nsResProtocolHandler.cpp | 1 + netwerk/protocol/rtsp/RtspChannelChild.cpp | 1 + .../rtsp/controller/RtspController.cpp | 1 - .../rtsp/controller/RtspControllerChild.cpp | 1 - .../rtsp/controller/RtspControllerParent.cpp | 1 - .../viewsource/nsViewSourceChannel.cpp | 1 + .../websocket/BaseWebSocketChannel.cpp | 3 + netwerk/protocol/websocket/PWebSocket.ipdl | 2 +- .../protocol/websocket/WebSocketChannel.cpp | 1 + .../websocket/WebSocketChannelChild.cpp | 28 +- .../websocket/WebSocketChannelParent.cpp | 22 +- .../websocket/WebSocketChannelParent.h | 2 +- netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp | 1 + .../wyciwyg/nsWyciwygProtocolHandler.cpp | 2 +- netwerk/sctp/datachannel/DataChannel.cpp | 1 + .../streamconv/converters/nsIndexedToHTML.cpp | 1 + .../converters/nsMultiMixedConv.cpp | 2 +- netwerk/streamconv/test/TestStreamConv.cpp | 1 + netwerk/test/TestBlockingSocket.cpp | 3 + netwerk/test/TestCallbacks.cpp | 2 + netwerk/test/TestCookie.cpp | 2 + netwerk/test/TestIncrementalDownload.cpp | 1 + netwerk/test/TestOpen.cpp | 1 + netwerk/test/TestProtocols.cpp | 1 + netwerk/test/TestServ.cpp | 5 +- netwerk/test/TestSocketTransport.cpp | 1 - netwerk/test/TestStreamLoader.cpp | 1 + netwerk/test/TestUDPSocket.cpp | 2 +- netwerk/test/TestUpload.cpp | 2 + parser/htmlparser/nsParser.cpp | 1 - parser/htmlparser/nsScanner.cpp | 1 - rdf/base/nsRDFService.cpp | 1 + rdf/base/nsRDFXMLDataSource.cpp | 3 +- rdf/base/rdfutil.cpp | 2 +- rdf/datasource/nsFileSystemDataSource.cpp | 2 + rdf/datasource/nsLocalStore.cpp | 1 + security/manager/ssl/CertBlocklist.cpp | 2 + security/manager/ssl/PSMContentListener.cpp | 3 + .../manager/ssl/SSLServerCertVerification.cpp | 2 +- .../manager/ssl/nsCertOverrideService.cpp | 1 + security/manager/ssl/nsClientAuthRemember.cpp | 1 - security/manager/ssl/nsNSSIOLayer.cpp | 3 +- security/manager/ssl/nsPKCS12Blob.cpp | 1 + .../manager/ssl/nsSecureBrowserUIImpl.cpp | 3 +- .../ssl/tests/gtest/DataStorageTest.cpp | 1 + startupcache/StartupCacheUtils.cpp | 1 + .../components/build/nsToolkitCompsModule.cpp | 1 + .../components/commandlines/nsCommandLine.cpp | 2 + .../downloads/ApplicationReputation.cpp | 2 + .../downloads/nsDownloadManager.cpp | 5 + .../downloads/nsDownloadScanner.cpp | 1 + toolkit/components/places/Database.cpp | 1 + toolkit/components/places/History.cpp | 1 + .../places/nsAnnoProtocolHandler.cpp | 1 + .../components/places/nsFaviconService.cpp | 1 + toolkit/components/places/nsNavHistory.cpp | 1 + .../places/tests/cpp/places_test_harness.h | 3 +- .../places/tests/cpp/test_IHistory.cpp | 1 + toolkit/devtools/inspector/inspector-panel.js | 185 +- toolkit/devtools/inspector/inspector.xul | 12 + toolkit/devtools/inspector/test/browser.ini | 3 + .../browser_inspector_menu-01-sensitivity.js | 3 +- .../test/browser_inspector_menu-04-other.js | 6 + .../test/browser_inspector_pane-toggle-01.js | 23 + .../test/browser_inspector_pane-toggle-02.js | 24 + .../test/browser_inspector_pane-toggle-03.js | 37 + toolkit/devtools/inspector/test/head.js | 10 +- toolkit/devtools/markupview/markup-view.css | 45 +- toolkit/devtools/markupview/markup-view.js | 551 +++- toolkit/devtools/markupview/test/browser.ini | 14 + ...rkupview_css_completion_style_attribute.js | 2 +- .../browser_markupview_dragdrop_autoscroll.js | 61 + ...rowser_markupview_dragdrop_invalidNodes.js | 58 + .../browser_markupview_dragdrop_isDragging.js | 41 + .../browser_markupview_dragdrop_reorder.js | 109 + ...owser_markupview_dragdrop_textSelection.js | 48 + .../test/browser_markupview_image_tooltip.js | 8 +- .../test/browser_markupview_links_01.js | 122 + .../test/browser_markupview_links_02.js | 37 + .../test/browser_markupview_links_03.js | 37 + .../test/browser_markupview_links_04.js | 108 + .../test/browser_markupview_links_05.js | 82 + .../test/browser_markupview_load_01.js | 70 + .../test/browser_markupview_mutation_01.js | 33 +- .../test/browser_markupview_mutation_02.js | 46 +- .../test/browser_markupview_tag_edit_02.js | 8 +- .../test/browser_markupview_tag_edit_03.js | 35 +- .../test/browser_markupview_tag_edit_06.js | 4 +- .../test/browser_markupview_tag_edit_07.js | 6 +- .../test/browser_markupview_tag_edit_08.js | 25 +- .../test/browser_markupview_tag_edit_09.js | 8 +- .../browser_markupview_textcontent_edit_01.js | 12 - .../test/browser_markupview_toggle_03.js | 12 - .../markupview/test/doc_markup_dragdrop.html | 31 + .../test/doc_markup_dragdrop_autoscroll.html | 51 + .../markupview/test/doc_markup_links.html | 42 + toolkit/devtools/markupview/test/head.js | 160 +- .../test/helper_attributes_test_runner.js | 14 +- toolkit/devtools/server/HeapSnapshot.cpp | 1 + toolkit/devtools/server/actors/inspector.js | 59 +- toolkit/devtools/server/actors/styles.js | 5 +- .../server/tests/mochitest/chrome.ini | 2 + .../mochitest/inspector-traversal-data.html | 1 + .../mochitest/test_inspector-resolve-url.html | 90 + .../test_inspector-scroll-into-view.html | 90 + toolkit/devtools/shared/frame-script-utils.js | 86 +- toolkit/devtools/shared/moz.build | 2 +- .../devtools/shared/node-attribute-parser.js | 278 ++ .../test/unit/test_attribute-parsing-01.js | 73 + .../test/unit/test_attribute-parsing-02.js | 131 + .../devtools/shared/test/unit/xpcshell.ini | 2 + .../chrome/global/devtools/inspector.dtd | 5 + .../global/devtools/inspector.properties | 43 + .../mozapps/extensions/AddonPathService.cpp | 1 + .../nsAndroidSystemProxySettings.cpp | 1 + toolkit/system/gnome/nsAlertsIconListener.cpp | 1 + .../osxproxy/nsOSXSystemProxySettings.mm | 2 +- .../system/unixproxy/nsLibProxySettings.cpp | 1 - .../unixproxy/nsUnixSystemProxySettings.cpp | 1 + .../nsWindowsSystemProxySettings.cpp | 2 +- toolkit/themes/shared/devtools/inspector.css | 38 + toolkit/xre/nsAppRunner.cpp | 1 + toolkit/xre/nsNativeAppSupportWin.cpp | 2 + uriloader/base/nsURILoader.cpp | 1 - .../exthandler/nsExternalHelperAppService.cpp | 1 + uriloader/exthandler/nsMIMEInfoImpl.cpp | 1 - .../prefetch/nsOfflineCacheUpdateService.cpp | 1 - widget/cocoa/nsDragService.mm | 1 - widget/gtk/nsPrintDialogGTK.cpp | 1 - widget/gtk/nsSound.cpp | 1 + widget/nsFilePickerProxy.cpp | 1 - widget/nsTransferable.cpp | 2 + widget/windows/JumpListBuilder.cpp | 1 - widget/windows/WinUtils.cpp | 3 + widget/windows/nsClipboard.cpp | 2 + widget/windows/nsDataObj.cpp | 2 + widget/windows/nsDragService.cpp | 1 - widget/windows/nsSound.cpp | 1 + xpcom/tests/gtest/TestCloneInputStream.cpp | 2 + xpfe/components/build/nsModule.cpp | 1 - .../directory/nsDirectoryViewer.cpp | 2 + xpfe/components/directory/nsDirectoryViewer.h | 3 +- 544 files changed, 7264 insertions(+), 3360 deletions(-) delete mode 100644 dom/base/test/csp/chrome.ini delete mode 100644 dom/base/test/csp/file_CSP_web_manifest.html delete mode 100644 dom/base/test/csp/file_CSP_web_manifest_https.html delete mode 100644 dom/base/test/csp/file_bug836922_npolicies.html delete mode 100644 dom/base/test/csp/file_bug886164.html delete mode 100644 dom/base/test/csp/file_bug886164_3.html delete mode 100644 dom/base/test/csp/file_bug886164_4.html delete mode 100644 dom/base/test/csp/file_csp_allow_https_schemes.html delete mode 100644 dom/base/test/csp/file_csp_bug768029.html delete mode 100644 dom/base/test/csp/file_csp_bug773891.html delete mode 100644 dom/base/test/csp/file_policyuri_regression_from_multipolicy.html^headers^ delete mode 100644 dom/base/test/mixedcontentblocker/mochitest.ini rename dom/{base => security}/test/TestCSPParser.cpp (100%) rename dom/{base/test => security/test/cors}/file_CrossSiteXHR_cache_server.sjs (89%) rename dom/{base/test => security/test/cors}/file_CrossSiteXHR_inner.html (100%) rename dom/{base/test => security/test/cors}/file_CrossSiteXHR_inner.jar (100%) rename dom/{base/test => security/test/cors}/file_CrossSiteXHR_inner_data.sjs (100%) rename dom/{base/test => security/test/cors}/file_CrossSiteXHR_server.sjs (98%) create mode 100644 dom/security/test/cors/mochitest.ini rename dom/{base/test => security/test/cors}/test_CrossSiteXHR.html (99%) rename dom/{base/test => security/test/cors}/test_CrossSiteXHR_cache.html (98%) rename dom/{base/test => security/test/cors}/test_CrossSiteXHR_origin.html (92%) rename dom/{base => security}/test/csp/browser.ini (100%) rename dom/{base => security}/test/csp/browser_test_web_manifest.js (95%) rename dom/{base => security}/test/csp/browser_test_web_manifest_mixed_content.js (83%) create mode 100644 dom/security/test/csp/chrome.ini rename dom/{base => security}/test/csp/file_CSP.css (82%) rename dom/{base => security}/test/csp/file_CSP.sjs (100%) create mode 100644 dom/security/test/csp/file_allow_https_schemes.html rename dom/{base => security}/test/csp/file_base-uri.html (100%) create mode 100644 dom/security/test/csp/file_blob_data_schemes.html rename dom/{base/test/csp/file_CSP_bug663567.xsl => security/test/csp/file_bug663567.xsl} (100%) rename dom/{base/test/csp/file_CSP_bug663567_allows.xml => security/test/csp/file_bug663567_allows.xml} (86%) rename dom/{base/test/csp/file_CSP_bug663567_allows.xml^headers^ => security/test/csp/file_bug663567_allows.xml^headers^} (100%) rename dom/{base/test/csp/file_CSP_bug663567_blocks.xml => security/test/csp/file_bug663567_blocks.xml} (86%) rename dom/{base/test/csp/file_CSP_bug663567_blocks.xml^headers^ => security/test/csp/file_bug663567_blocks.xml^headers^} (100%) create mode 100644 dom/security/test/csp/file_bug768029.html rename dom/{base/test/csp/file_csp_bug768029.sjs => security/test/csp/file_bug768029.sjs} (100%) create mode 100644 dom/security/test/csp/file_bug773891.html rename dom/{base/test/csp/file_csp_bug773891.sjs => security/test/csp/file_bug773891.sjs} (100%) rename dom/{base/test/csp/file_CSP_bug802872.html => security/test/csp/file_bug802872.html} (83%) rename dom/{base/test/csp/file_CSP_bug802872.html^headers^ => security/test/csp/file_bug802872.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_bug802872.js => security/test/csp/file_bug802872.js} (93%) rename dom/{base/test/csp/file_CSP_bug802872.sjs => security/test/csp/file_bug802872.sjs} (100%) create mode 100644 dom/security/test/csp/file_bug836922_npolicies.html rename dom/{base => security}/test/csp/file_bug836922_npolicies.html^headers^ (54%) rename dom/{base => security}/test/csp/file_bug836922_npolicies_ro_violation.sjs (100%) rename dom/{base => security}/test/csp/file_bug836922_npolicies_violation.sjs (100%) rename dom/{base/test/csp/file_CSP_bug885433_allows.html => security/test/csp/file_bug885433_allows.html} (100%) rename dom/{base/test/csp/file_CSP_bug885433_allows.html^headers^ => security/test/csp/file_bug885433_allows.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_bug885433_blocks.html => security/test/csp/file_bug885433_blocks.html} (100%) rename dom/{base/test/csp/file_CSP_bug885433_blocks.html^headers^ => security/test/csp/file_bug885433_blocks.html^headers^} (100%) create mode 100644 dom/security/test/csp/file_bug886164.html rename dom/{base => security}/test/csp/file_bug886164.html^headers^ (100%) rename dom/{base => security}/test/csp/file_bug886164_2.html (53%) rename dom/{base => security}/test/csp/file_bug886164_2.html^headers^ (100%) create mode 100644 dom/security/test/csp/file_bug886164_3.html rename dom/{base => security}/test/csp/file_bug886164_3.html^headers^ (100%) create mode 100644 dom/security/test/csp/file_bug886164_4.html rename dom/{base => security}/test/csp/file_bug886164_4.html^headers^ (100%) rename dom/{base => security}/test/csp/file_bug886164_5.html (62%) rename dom/{base => security}/test/csp/file_bug886164_5.html^headers^ (100%) rename dom/{base => security}/test/csp/file_bug886164_6.html (83%) rename dom/{base => security}/test/csp/file_bug886164_6.html^headers^ (100%) rename dom/{base/test/csp/file_CSP_bug888172.html => security/test/csp/file_bug888172.html} (100%) rename dom/{base/test/csp/file_CSP_bug888172.sjs => security/test/csp/file_bug888172.sjs} (94%) rename dom/{base/test/csp/file_CSP_bug909029_none.html => security/test/csp/file_bug909029_none.html} (100%) rename dom/{base/test/csp/file_CSP_bug909029_none.html^headers^ => security/test/csp/file_bug909029_none.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_bug909029_star.html => security/test/csp/file_bug909029_star.html} (100%) rename dom/{base/test/csp/file_CSP_bug909029_star.html^headers^ => security/test/csp/file_bug909029_star.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_bug910139.sjs => security/test/csp/file_bug910139.sjs} (89%) rename dom/{base/test/csp/file_CSP_bug910139.xml => security/test/csp/file_bug910139.xml} (89%) rename dom/{base/test/csp/file_CSP_bug910139.xsl => security/test/csp/file_bug910139.xsl} (100%) rename dom/{base/test/csp/file_CSP_bug941404.html => security/test/csp/file_bug941404.html} (64%) rename dom/{base/test/csp/file_CSP_bug941404_xhr.html => security/test/csp/file_bug941404_xhr.html} (100%) rename dom/{base/test/csp/file_CSP_bug941404_xhr.html^headers^ => security/test/csp/file_bug941404_xhr.html^headers^} (100%) create mode 100644 dom/security/test/csp/file_connect-src-fetch.html rename dom/{base => security}/test/csp/file_connect-src.html (74%) rename dom/{base/test/csp/file_CSP_evalscript_main.html => security/test/csp/file_evalscript_main.html} (72%) rename dom/{base/test/csp/file_CSP_evalscript_main.html^headers^ => security/test/csp/file_evalscript_main.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_evalscript_main.js => security/test/csp/file_evalscript_main.js} (100%) rename dom/{base/test/csp/file_CSP_evalscript_main_allowed.html => security/test/csp/file_evalscript_main_allowed.html} (69%) rename dom/{base/test/csp/file_CSP_evalscript_main_allowed.html^headers^ => security/test/csp/file_evalscript_main_allowed.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_evalscript_main_allowed.js => security/test/csp/file_evalscript_main_allowed.js} (100%) rename dom/{base => security}/test/csp/file_form-action.html (100%) rename dom/{base/test/csp/file_CSP_frameancestors.sjs => security/test/csp/file_frameancestors.sjs} (89%) rename dom/{base/test/csp/file_CSP_frameancestors_main.html => security/test/csp/file_frameancestors_main.html} (95%) rename dom/{base/test/csp/file_CSP_frameancestors_main.js => security/test/csp/file_frameancestors_main.js} (93%) rename dom/{base => security}/test/csp/file_hash_source.html (100%) rename dom/{base => security}/test/csp/file_hash_source.html^headers^ (100%) create mode 100644 dom/security/test/csp/file_ignore_unsafe_inline.html rename dom/{base/test/csp/file_CSP_inlinescript_main.html => security/test/csp/file_inlinescript_main.html} (100%) rename dom/{base/test/csp/file_CSP_inlinescript_main.html^headers^ => security/test/csp/file_inlinescript_main.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_inlinescript_main_allowed.html => security/test/csp/file_inlinescript_main_allowed.html} (100%) rename dom/{base/test/csp/file_CSP_inlinescript_main_allowed.html^headers^ => security/test/csp/file_inlinescript_main_allowed.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_inlinestyle_main.html => security/test/csp/file_inlinestyle_main.html} (100%) rename dom/{base/test/csp/file_CSP_inlinestyle_main.html^headers^ => security/test/csp/file_inlinestyle_main.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_inlinestyle_main_allowed.html => security/test/csp/file_inlinestyle_main_allowed.html} (100%) rename dom/{base/test/csp/file_CSP_inlinestyle_main_allowed.html^headers^ => security/test/csp/file_inlinestyle_main_allowed.html^headers^} (100%) rename dom/{base/test/csp/file_csp_invalid_source_expression.html => security/test/csp/file_invalid_source_expression.html} (50%) rename dom/{base => security}/test/csp/file_leading_wildcard.html (54%) rename dom/{base/test/csp/file_CSP_main.html => security/test/csp/file_main.html} (60%) rename dom/{base/test/csp/file_CSP_main.html^headers^ => security/test/csp/file_main.html^headers^} (100%) rename dom/{base/test/csp/file_CSP_main.js => security/test/csp/file_main.js} (59%) rename dom/{base => security}/test/csp/file_multi_policy_injection_bypass.html (61%) rename dom/{base => security}/test/csp/file_multi_policy_injection_bypass.html^headers^ (100%) rename dom/{base => security}/test/csp/file_multi_policy_injection_bypass_2.html (61%) rename dom/{base => security}/test/csp/file_multi_policy_injection_bypass_2.html^headers^ (100%) rename dom/{base => security}/test/csp/file_nonce_source.html (85%) rename dom/{base => security}/test/csp/file_nonce_source.html^headers^ (100%) rename dom/{base => security}/test/csp/file_null_baseuri.html (100%) rename dom/{base/test/csp/file_csp_path_matching.html => security/test/csp/file_path_matching.html} (63%) rename dom/{base/test/csp/file_csp_path_matching.js => security/test/csp/file_path_matching.js} (100%) rename dom/{base/test/csp/file_csp_path_matching_incl_query.html => security/test/csp/file_path_matching_incl_query.html} (64%) rename dom/{base/test/csp/file_csp_path_matching_redirect.html => security/test/csp/file_path_matching_redirect.html} (61%) rename dom/{base/test/csp/file_csp_path_matching_redirect_server.sjs => security/test/csp/file_path_matching_redirect_server.sjs} (78%) rename dom/{base => security}/test/csp/file_policyuri_regression_from_multipolicy.html (100%) create mode 100644 dom/security/test/csp/file_policyuri_regression_from_multipolicy.html^headers^ rename dom/{base => security}/test/csp/file_policyuri_regression_from_multipolicy_policy (100%) rename dom/{base => security}/test/csp/file_redirect_content.sjs (95%) rename dom/{base => security}/test/csp/file_redirect_report.sjs (100%) rename dom/{base/test/csp/file_csp_redirects_main.html => security/test/csp/file_redirects_main.html} (95%) rename dom/{base/test/csp/file_csp_redirects_page.sjs => security/test/csp/file_redirects_page.sjs} (98%) rename dom/{base/test/csp/file_csp_redirects_resource.sjs => security/test/csp/file_redirects_resource.sjs} (98%) rename dom/{base/test/csp/file_csp_referrerdirective.html => security/test/csp/file_referrerdirective.html} (80%) rename dom/{base/test/csp/file_csp_report.html => security/test/csp/file_report.html} (100%) rename dom/{base => security}/test/csp/file_report_uri_missing_in_report_only_header.html (100%) rename dom/{base => security}/test/csp/file_report_uri_missing_in_report_only_header.html^headers^ (100%) create mode 100644 dom/security/test/csp/file_scheme_relative_sources.js create mode 100644 dom/security/test/csp/file_scheme_relative_sources.sjs rename dom/{base => security}/test/csp/file_self_none_as_hostname_confusion.html (100%) rename dom/{base => security}/test/csp/file_self_none_as_hostname_confusion.html^headers^ (100%) rename dom/{base => security}/test/csp/file_subframe_run_js_if_allowed.html (100%) rename dom/{base => security}/test/csp/file_subframe_run_js_if_allowed.html^headers^ (100%) rename dom/{base/test/csp/file_csp_testserver.sjs => security/test/csp/file_testserver.sjs} (100%) create mode 100644 dom/security/test/csp/file_web_manifest.html rename dom/{base/test/csp/file_CSP_web_manifest.json => security/test/csp/file_web_manifest.json} (100%) rename dom/{base/test/csp/file_CSP_web_manifest.json^headers^ => security/test/csp/file_web_manifest.json^headers^} (100%) create mode 100644 dom/security/test/csp/file_web_manifest_https.html rename dom/{base/test/csp/file_CSP_web_manifest_https.json => security/test/csp/file_web_manifest_https.json} (100%) rename dom/{base/test/csp/file_CSP_web_manifest_mixed_content.html => security/test/csp/file_web_manifest_mixed_content.html} (54%) rename dom/{base/test/csp/file_CSP_web_manifest_remote.html => security/test/csp/file_web_manifest_remote.html} (60%) rename dom/{base => security}/test/csp/file_worker_redirect.html (100%) rename dom/{base => security}/test/csp/file_worker_redirect.sjs (91%) rename dom/{base => security}/test/csp/mochitest.ini (51%) rename dom/{base => security}/test/csp/referrerdirective.sjs (94%) rename dom/{base => security}/test/csp/test_301_redirect.html (100%) rename dom/{base => security}/test/csp/test_302_redirect.html (100%) rename dom/{base => security}/test/csp/test_303_redirect.html (100%) rename dom/{base => security}/test/csp/test_307_redirect.html (100%) rename dom/{base => security}/test/csp/test_CSP.html (98%) rename dom/{base/test/csp/test_csp_allow_https_schemes.html => security/test/csp/test_allow_https_schemes.html} (92%) rename dom/{base => security}/test/csp/test_base-uri.html (93%) create mode 100644 dom/security/test/csp/test_blob_data_schemes.html rename dom/{base/test/csp/test_CSP_bug663567.html => security/test/csp/test_bug663567.html} (88%) rename dom/{base/test/csp/test_csp_bug768029.html => security/test/csp/test_bug768029.html} (96%) rename dom/{base/test/csp/test_csp_bug773891.html => security/test/csp/test_bug773891.html} (97%) rename dom/{base/test/csp/test_CSP_bug802872.html => security/test/csp/test_bug802872.html} (95%) rename dom/{base => security}/test/csp/test_bug836922_npolicies.html (99%) rename dom/{base/test/csp/test_CSP_bug885433.html => security/test/csp/test_bug885433.html} (93%) rename dom/{base => security}/test/csp/test_bug886164.html (99%) rename dom/{base/test/csp/test_CSP_bug888172.html => security/test/csp/test_bug888172.html} (92%) rename dom/{base/test/csp/test_CSP_bug909029.html => security/test/csp/test_bug909029.html} (96%) rename dom/{base/test/csp/test_CSP_bug910139.html => security/test/csp/test_bug910139.html} (87%) rename dom/{base/test/csp/test_CSP_bug941404.html => security/test/csp/test_bug941404.html} (96%) rename dom/{base => security}/test/csp/test_bug949549.html (100%) rename dom/{base => security}/test/csp/test_connect-src.html (75%) rename dom/{base/test/csp/test_CSP_evalscript.html => security/test/csp/test_evalscript.html} (91%) rename dom/{base => security}/test/csp/test_form-action.html (96%) rename dom/{base/test/csp/test_CSP_frameancestors.html => security/test/csp/test_frameancestors.html} (97%) rename dom/{base => security}/test/csp/test_hash_source.html (100%) create mode 100644 dom/security/test/csp/test_ignore_unsafe_inline.html rename dom/{base/test/csp/test_CSP_inlinescript.html => security/test/csp/test_inlinescript.html} (95%) rename dom/{base/test/csp/test_CSP_inlinestyle.html => security/test/csp/test_inlinestyle.html} (97%) rename dom/{base/test/csp/test_csp_invalid_source_expression.html => security/test/csp/test_invalid_source_expression.html} (94%) rename dom/{base => security}/test/csp/test_leading_wildcard.html (96%) rename dom/{base => security}/test/csp/test_multi_policy_injection_bypass.html (98%) rename dom/{base => security}/test/csp/test_nonce_source.html (100%) rename dom/{base => security}/test/csp/test_null_baseuri.html (94%) rename dom/{base/test/csp/test_csp_path_matching.html => security/test/csp/test_path_matching.html} (63%) rename dom/{base/test/csp/test_csp_path_matching_redirect.html => security/test/csp/test_path_matching_redirect.html} (88%) rename dom/{base => security}/test/csp/test_policyuri_regression_from_multipolicy.html (100%) rename dom/{base/test/csp/test_csp_redirects.html => security/test/csp/test_redirects.html} (97%) rename dom/{base/test/csp/test_CSP_referrerdirective.html => security/test/csp/test_referrerdirective.html} (96%) rename dom/{base/test/csp/test_csp_report.html => security/test/csp/test_report.html} (94%) rename dom/{base => security}/test/csp/test_report_uri_missing_in_report_only_header.html (100%) create mode 100644 dom/security/test/csp/test_scheme_relative_sources.html rename dom/{base => security}/test/csp/test_self_none_as_hostname_confusion.html (100%) rename dom/{base => security}/test/csp/test_subframe_run_js_if_allowed.html (100%) rename dom/{base => security}/test/csp/test_worker_redirect.html (95%) rename dom/{base/test/mixedcontentblocker/bug803225_test_mailto.html => security/test/mixedcontentblocker/file_bug803225_test_mailto.html} (100%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_frameNavigation.html => security/test/mixedcontentblocker/file_frameNavigation.html} (85%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_frameNavigation_blankTarget.html => security/test/mixedcontentblocker/file_frameNavigation_blankTarget.html} (84%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_frameNavigation_grandchild.html => security/test/mixedcontentblocker/file_frameNavigation_grandchild.html} (81%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_frameNavigation_innermost.html => security/test/mixedcontentblocker/file_frameNavigation_innermost.html} (76%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_frameNavigation_secure.html => security/test/mixedcontentblocker/file_frameNavigation_secure.html} (84%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_frameNavigation_secure_grandchild.html => security/test/mixedcontentblocker/file_frameNavigation_secure_grandchild.html} (84%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_main.html => security/test/mixedcontentblocker/file_main.html} (98%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_main_bug803225.html => security/test/mixedcontentblocker/file_main_bug803225.html} (96%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_main_bug803225_websocket_wsh.py => security/test/mixedcontentblocker/file_main_bug803225_websocket_wsh.py} (100%) rename dom/{base/test/mixedcontentblocker/file_mixed_content_server.sjs => security/test/mixedcontentblocker/file_server.sjs} (100%) create mode 100644 dom/security/test/mixedcontentblocker/mochitest.ini rename dom/{base/test/mixedcontentblocker/test_mixed_content_blocker_bug803225.html => security/test/mixedcontentblocker/test_bug803225.html} (95%) rename dom/{base/test/mixedcontentblocker/test_mixed_content_blocker_frameNavigation.html => security/test/mixedcontentblocker/test_frameNavigation.html} (91%) rename dom/{base/test/mixedcontentblocker/test_mixed_content_blocker.html => security/test/mixedcontentblocker/test_main.html} (98%) create mode 100644 dom/security/test/moz.build rename dom/{base/test/unit/test_cspreports.js => security/test/unit/test_csp_reports.js} (99%) create mode 100644 dom/security/test/unit/xpcshell.ini delete mode 100644 netwerk/base/nsINetUtil_ESR_38.idl create mode 100644 netwerk/base/nsNetUtil.inl create mode 100644 toolkit/devtools/inspector/test/browser_inspector_pane-toggle-01.js create mode 100644 toolkit/devtools/inspector/test/browser_inspector_pane-toggle-02.js create mode 100644 toolkit/devtools/inspector/test/browser_inspector_pane-toggle-03.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_dragdrop_autoscroll.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_dragdrop_invalidNodes.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_dragdrop_isDragging.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_dragdrop_reorder.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_dragdrop_textSelection.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_links_01.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_links_02.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_links_03.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_links_04.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_links_05.js create mode 100644 toolkit/devtools/markupview/test/browser_markupview_load_01.js create mode 100644 toolkit/devtools/markupview/test/doc_markup_dragdrop.html create mode 100644 toolkit/devtools/markupview/test/doc_markup_dragdrop_autoscroll.html create mode 100644 toolkit/devtools/markupview/test/doc_markup_links.html create mode 100644 toolkit/devtools/server/tests/mochitest/test_inspector-resolve-url.html create mode 100644 toolkit/devtools/server/tests/mochitest/test_inspector-scroll-into-view.html create mode 100644 toolkit/devtools/shared/node-attribute-parser.js create mode 100644 toolkit/devtools/shared/test/unit/test_attribute-parsing-01.js create mode 100644 toolkit/devtools/shared/test/unit/test_attribute-parsing-02.js diff --git a/accessible/generic/Accessible.cpp b/accessible/generic/Accessible.cpp index 9cd70b8e16..7f451ff898 100644 --- a/accessible/generic/Accessible.cpp +++ b/accessible/generic/Accessible.cpp @@ -65,7 +65,6 @@ #include "nsIServiceManager.h" #include "nsWhitespaceTokenizer.h" #include "nsAttrName.h" -#include "nsNetUtil.h" #ifdef DEBUG #include "nsIDOMCharacterData.h" diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp index 8c2928c58e..3d01f8f4e9 100644 --- a/browser/components/about/AboutRedirector.cpp +++ b/browser/components/about/AboutRedirector.cpp @@ -7,6 +7,8 @@ #include "AboutRedirector.h" #include "nsNetUtil.h" +#include "nsIChannel.h" +#include "nsIURI.h" #include "nsIScriptSecurityManager.h" #include "mozilla/ArrayUtils.h" #include "nsDOMString.h" diff --git a/browser/components/migration/nsIEHistoryEnumerator.cpp b/browser/components/migration/nsIEHistoryEnumerator.cpp index 77ec2e8520..8cdc6e15cd 100644 --- a/browser/components/migration/nsIEHistoryEnumerator.cpp +++ b/browser/components/migration/nsIEHistoryEnumerator.cpp @@ -9,6 +9,7 @@ #include "nsStringAPI.h" #include "nsNetUtil.h" +#include "prtime.h" #include "nsIVariant.h" #include "nsCOMArray.h" #include "nsArrayEnumerator.h" diff --git a/browser/components/shell/nsGNOMEShellService.cpp b/browser/components/shell/nsGNOMEShellService.cpp index 14510d1113..4d95655887 100644 --- a/browser/components/shell/nsGNOMEShellService.cpp +++ b/browser/components/shell/nsGNOMEShellService.cpp @@ -21,7 +21,8 @@ #include "nsIStringBundle.h" #include "nsIOutputStream.h" #include "nsIProcess.h" -#include "nsNetUtil.h" +#include "nsServiceManagerUtils.h" +#include "nsComponentManagerUtils.h" #include "nsIDOMHTMLImageElement.h" #include "nsIImageLoadingContent.h" #include "imgIRequest.h" diff --git a/browser/components/shell/nsMacShellService.cpp b/browser/components/shell/nsMacShellService.cpp index 914b9ae653..0ad2e71676 100644 --- a/browser/components/shell/nsMacShellService.cpp +++ b/browser/components/shell/nsMacShellService.cpp @@ -17,7 +17,8 @@ #include "nsIURL.h" #include "nsIWebBrowserPersist.h" #include "nsMacShellService.h" -#include "nsNetUtil.h" +#include "nsIProperties.h" +#include "nsServiceManagerUtils.h" #include "nsShellService.h" #include "nsStringAPI.h" #include "nsIDocShell.h" diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index 813ec4fe12..714cff0c32 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -15,6 +15,7 @@ #include "nsIServiceManager.h" #include "nsIStringBundle.h" #include "nsNetUtil.h" +#include "nsServiceManagerUtils.h" #include "nsShellService.h" #include "nsWindowsShellService.h" #include "nsIProcess.h" diff --git a/caps/BasePrincipal.cpp b/caps/BasePrincipal.cpp index 67b988ac00..7463c3cbba 100644 --- a/caps/BasePrincipal.cpp +++ b/caps/BasePrincipal.cpp @@ -12,6 +12,7 @@ #include "nsPrincipal.h" #include "nsNetUtil.h" +#include "nsIURIWithPrincipal.h" #include "nsNullPrincipal.h" #include "nsScriptSecurityManager.h" diff --git a/caps/nsNullPrincipal.cpp b/caps/nsNullPrincipal.cpp index 5dba6f941c..cc32748425 100644 --- a/caps/nsNullPrincipal.cpp +++ b/caps/nsNullPrincipal.cpp @@ -15,7 +15,7 @@ #include "nsNullPrincipal.h" #include "nsNullPrincipalURI.h" #include "nsMemory.h" -#include "nsNetUtil.h" +#include "nsIURIWithPrincipal.h" #include "nsIClassInfoImpl.h" #include "nsNetCID.h" #include "nsError.h" diff --git a/caps/nsNullPrincipalURI.cpp b/caps/nsNullPrincipalURI.cpp index 9d092ed376..74118bc00f 100644 --- a/caps/nsNullPrincipalURI.cpp +++ b/caps/nsNullPrincipalURI.cpp @@ -11,7 +11,6 @@ #include "mozilla/ipc/URIParams.h" -#include "nsNetUtil.h" #include "nsEscape.h" #include "nsCRT.h" #include "nsIUUIDGenerator.h" diff --git a/caps/nsPrincipal.cpp b/caps/nsPrincipal.cpp index e88f336c70..fffbf59b94 100644 --- a/caps/nsPrincipal.cpp +++ b/caps/nsPrincipal.cpp @@ -13,6 +13,8 @@ #include "nsReadableUtils.h" #include "pratom.h" #include "nsIURI.h" +#include "nsIURL.h" +#include "nsIURIWithPrincipal.h" #include "nsJSPrincipals.h" #include "nsIEffectiveTLDService.h" #include "nsIClassInfoImpl.h" diff --git a/chrome/nsChromeProtocolHandler.cpp b/chrome/nsChromeProtocolHandler.cpp index 2246565cfb..f4eec56d47 100644 --- a/chrome/nsChromeProtocolHandler.cpp +++ b/chrome/nsChromeProtocolHandler.cpp @@ -23,6 +23,8 @@ #include "nsIScriptSecurityManager.h" #include "nsIStandardURL.h" #include "nsNetUtil.h" +#include "nsNetCID.h" +#include "nsIURL.h" #include "nsString.h" #include "nsStandardURL.h" diff --git a/docshell/base/SerializedLoadContext.cpp b/docshell/base/SerializedLoadContext.cpp index f328845b64..0af32e5fd3 100644 --- a/docshell/base/SerializedLoadContext.cpp +++ b/docshell/base/SerializedLoadContext.cpp @@ -7,6 +7,7 @@ #include "SerializedLoadContext.h" #include "nsNetUtil.h" #include "nsIChannel.h" +#include "nsIPrivateBrowsingChannel.h" #include "nsIWebSocketChannel.h" namespace IPC { diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index 4183c187b2..938317c8a4 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -4,7 +4,9 @@ * License, v. 2.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 "nsNetCID.h" #include "nsNetUtil.h" +#include "nsIProtocolHandler.h" #include "nsCRT.h" #include "nsIFile.h" diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index bf72005b4b..c130430451 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -19,6 +19,7 @@ #include "mozilla/dom/ToJSValue.h" #include "mozilla/dom/workers/ServiceWorkerManager.h" #include "mozilla/EventStateManager.h" +#include "mozilla/LoadInfo.h" #include "mozilla/Preferences.h" #include "mozilla/Services.h" #include "mozilla/StartupTimeline.h" @@ -38,6 +39,7 @@ #include "nsCURILoader.h" #include "nsDocShellCID.h" #include "nsDOMCID.h" +#include "nsNetCID.h" #include "nsNetUtil.h" #include "mozilla/net/ReferrerPolicy.h" #include "nsRect.h" @@ -182,13 +184,18 @@ #include "nsIDOMNode.h" #include "nsIDocShellTreeOwner.h" #include "nsIHttpChannel.h" +#include "nsIIDNService.h" +#include "nsIInputStreamChannel.h" +#include "nsINestedURI.h" #include "nsISHContainer.h" #include "nsISHistory.h" #include "nsISecureBrowserUI.h" +#include "nsISocketProvider.h" #include "nsIStringBundle.h" #include "nsISupportsArray.h" #include "nsIURIFixup.h" #include "nsIURILoader.h" +#include "nsIURL.h" #include "nsIWebBrowserFind.h" #include "nsIWidget.h" #include "mozilla/dom/EncodingUtils.h" diff --git a/dom/archivereader/ArchiveReader.cpp b/dom/archivereader/ArchiveReader.cpp index cc0d445d8e..76ce16bc96 100644 --- a/dom/archivereader/ArchiveReader.cpp +++ b/dom/archivereader/ArchiveReader.cpp @@ -10,7 +10,7 @@ #include "ArchiveZipEvent.h" #include "nsIURI.h" -#include "nsNetUtil.h" +#include "nsNetCID.h" #include "mozilla/dom/ArchiveReaderBinding.h" #include "mozilla/dom/BindingDeclarations.h" diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 6a753e4587..3a147605ae 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -29,7 +29,6 @@ #include "nsILinkHandler.h" #include "nsIScriptGlobalObject.h" #include "nsIURL.h" -#include "nsNetUtil.h" #include "nsContainerFrame.h" #include "nsIAnonymousContentCreator.h" #include "nsIPresShell.h" diff --git a/dom/base/EventSource.cpp b/dom/base/EventSource.cpp index 21af38d9f6..14444003a0 100644 --- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -15,6 +15,9 @@ #include "mozilla/dom/ScriptSettings.h" #include "nsNetUtil.h" +#include "nsIAuthPrompt.h" +#include "nsIAuthPrompt2.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsMimeTypes.h" #include "nsIPromptFactory.h" #include "nsIWindowWatcher.h" diff --git a/dom/base/ImageEncoder.cpp b/dom/base/ImageEncoder.cpp index a7d141867d..ba2d192b14 100644 --- a/dom/base/ImageEncoder.cpp +++ b/dom/base/ImageEncoder.cpp @@ -11,6 +11,7 @@ #include "mozilla/RefPtr.h" #include "mozilla/SyncRunnable.h" #include "gfxUtils.h" +#include "nsNetUtil.h" using namespace mozilla::gfx; diff --git a/dom/base/ImageEncoder.h b/dom/base/ImageEncoder.h index 47905d1168..fe3522daff 100644 --- a/dom/base/ImageEncoder.h +++ b/dom/base/ImageEncoder.h @@ -12,7 +12,6 @@ #include "mozilla/dom/File.h" #include "mozilla/dom/HTMLCanvasElementBinding.h" #include "nsLayoutUtils.h" -#include "nsNetUtil.h" #include "nsSize.h" class nsICanvasRenderingContextInternal; diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 0e0b759b70..25e7e64d46 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -63,6 +63,9 @@ #include "nsIPermissionManager.h" #include "nsMimeTypes.h" #include "nsNetUtil.h" +#include "nsStringStream.h" +#include "nsComponentManagerUtils.h" +#include "nsIStringStream.h" #include "nsIHttpChannel.h" #include "nsIHttpChannelInternal.h" #include "TimeManager.h" diff --git a/dom/base/ResponsiveImageSelector.cpp b/dom/base/ResponsiveImageSelector.cpp index 8c9e837119..609ef00a64 100644 --- a/dom/base/ResponsiveImageSelector.cpp +++ b/dom/base/ResponsiveImageSelector.cpp @@ -9,7 +9,6 @@ #include "nsIDocument.h" #include "nsContentUtils.h" #include "nsPresContext.h" -#include "nsNetUtil.h" #include "nsCSSParser.h" #include "nsCSSProps.h" diff --git a/dom/base/ThirdPartyUtil.cpp b/dom/base/ThirdPartyUtil.cpp index 16c1b462b3..e37992c337 100644 --- a/dom/base/ThirdPartyUtil.cpp +++ b/dom/base/ThirdPartyUtil.cpp @@ -5,7 +5,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ThirdPartyUtil.h" +#include "nsNetCID.h" #include "nsNetUtil.h" +#include "nsIChannel.h" #include "nsIServiceManager.h" #include "nsIHttpChannelInternal.h" #include "nsIDOMWindow.h" diff --git a/dom/base/WebSocket.cpp b/dom/base/WebSocket.cpp index 744925c1a7..e4250d3e1b 100644 --- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -40,6 +40,8 @@ #include "nsJSUtils.h" #include "nsIScriptError.h" #include "nsNetUtil.h" +#include "nsIAuthPrompt.h" +#include "nsIAuthPrompt2.h" #include "nsILoadGroup.h" #include "mozilla/Preferences.h" #include "xpcpublic.h" diff --git a/dom/base/nsContentSink.cpp b/dom/base/nsContentSink.cpp index 3f60173a89..cb8fcf40ba 100644 --- a/dom/base/nsContentSink.cpp +++ b/dom/base/nsContentSink.cpp @@ -20,6 +20,8 @@ #include "nsCPrefetchService.h" #include "nsIURI.h" #include "nsNetUtil.h" +#include "nsIMIMEHeaderParam.h" +#include "nsIProtocolHandler.h" #include "nsIHttpChannel.h" #include "nsIContent.h" #include "nsIPresShell.h" diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index dbd3123b82..93e9bb8e2d 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -135,6 +135,7 @@ #include "nsILoadContext.h" #include "nsILoadGroup.h" #include "nsIMemoryReporter.h" +#include "nsIMIMEHeaderParam.h" #include "nsIMIMEService.h" #include "nsINode.h" #include "mozilla/dom/NodeInfo.h" @@ -156,6 +157,7 @@ #include "nsIStreamConverterService.h" #include "nsIStringBundle.h" #include "nsIURI.h" +#include "nsIURIWithPrincipal.h" #include "nsIURL.h" #include "nsIWebNavigation.h" #include "nsIWordBreaker.h" diff --git a/dom/base/nsDOMDataChannel.cpp b/dom/base/nsDOMDataChannel.cpp index a96da7373e..1eba17484a 100644 --- a/dom/base/nsDOMDataChannel.cpp +++ b/dom/base/nsDOMDataChannel.cpp @@ -27,7 +27,6 @@ extern PRLogModuleInfo* GetDataChannelLog(); #include "nsContentUtils.h" #include "nsCycleCollectionParticipant.h" #include "nsIScriptObjectPrincipal.h" -#include "nsNetUtil.h" #include "DataChannel.h" diff --git a/dom/base/nsDOMFileReader.cpp b/dom/base/nsDOMFileReader.cpp index cb0ef2fc7e..bcc11235b3 100644 --- a/dom/base/nsDOMFileReader.cpp +++ b/dom/base/nsDOMFileReader.cpp @@ -12,7 +12,6 @@ #include "nsError.h" #include "nsIFile.h" #include "nsNetCID.h" -#include "nsNetUtil.h" #include "nsXPCOM.h" #include "nsIDOMEventListener.h" diff --git a/dom/base/nsDataDocumentContentPolicy.cpp b/dom/base/nsDataDocumentContentPolicy.cpp index 5154afb866..44e29a5328 100644 --- a/dom/base/nsDataDocumentContentPolicy.cpp +++ b/dom/base/nsDataDocumentContentPolicy.cpp @@ -13,6 +13,7 @@ #include "nsContentUtils.h" #include "nsDataDocumentContentPolicy.h" #include "nsNetUtil.h" +#include "nsIProtocolHandler.h" #include "nsScriptSecurityManager.h" #include "nsIDocument.h" #include "nsINode.h" diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index e84b40ccff..ad13cee240 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -84,7 +84,10 @@ #include "nsIScriptError.h" #include "nsStyleSheetService.h" -#include "nsNetUtil.h" // for NS_MakeAbsoluteURI +#include "nsNetUtil.h" // for NS_NewURI +#include "nsIInputStreamChannel.h" +#include "nsIAuthPrompt.h" +#include "nsIAuthPrompt2.h" #include "nsIScriptSecurityManager.h" #include "nsIPrincipal.h" diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 781a73a36c..a9638b048f 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -31,6 +31,7 @@ #include "mozilla/dom/WakeLock.h" #include "mozilla/dom/power/PowerManagerService.h" #include "nsIDocShellTreeOwner.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsIPermissionManager.h" #include "nsIScriptContext.h" #include "nsIScriptTimeoutHandler.h" @@ -40,6 +41,7 @@ #include "nsWindowMemoryReporter.h" #include "WindowNamedPropertiesHandler.h" #include "nsFrameSelection.h" +#include "nsNetUtil.h" // Helper Classes #include "nsJSUtils.h" diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index a0dcbb46e6..2af977b2f0 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -76,7 +76,6 @@ #include "nsIWidget.h" #include "nsLayoutUtils.h" #include "nsNameSpaceManager.h" -#include "nsNetUtil.h" #include "nsNodeInfoManager.h" #include "nsNodeUtils.h" #include "nsPIBoxObject.h" diff --git a/dom/base/nsInProcessTabChildGlobal.cpp b/dom/base/nsInProcessTabChildGlobal.cpp index 92d7a28a31..41a8c34f83 100644 --- a/dom/base/nsInProcessTabChildGlobal.cpp +++ b/dom/base/nsInProcessTabChildGlobal.cpp @@ -11,7 +11,6 @@ #include "nsIComponentManager.h" #include "nsIServiceManager.h" #include "nsComponentManagerUtils.h" -#include "nsNetUtil.h" #include "nsScriptLoader.h" #include "nsFrameLoader.h" #include "xpcpublic.h" diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 992d65ad3d..177626a04b 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -34,7 +34,6 @@ #include "mozilla/EventDispatcher.h" #include "nsIContent.h" #include "nsCycleCollector.h" -#include "nsNetUtil.h" #include "nsXPCOMCIDInternal.h" #include "nsIXULRuntime.h" #include "nsTextFormatter.h" diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index 756a8d7de7..37f5e0a8f6 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -20,6 +20,7 @@ #include "nsIDOMHTMLObjectElement.h" #include "nsIDOMHTMLAppletElement.h" #include "nsIExternalProtocolHandler.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsIHttpChannelInternal.h" #include "nsIObjectFrame.h" #include "nsIPermissionManager.h" diff --git a/dom/base/nsStyleLinkElement.cpp b/dom/base/nsStyleLinkElement.cpp index 3cb51e5dac..f8992a0fef 100644 --- a/dom/base/nsStyleLinkElement.cpp +++ b/dom/base/nsStyleLinkElement.cpp @@ -23,7 +23,6 @@ #include "nsIDOMComment.h" #include "nsIDOMNode.h" #include "nsIDOMStyleSheet.h" -#include "nsNetUtil.h" #include "nsUnicharUtils.h" #include "nsCRT.h" #include "nsXPCOMCIDInternal.h" diff --git a/dom/base/nsXMLHttpRequest.cpp b/dom/base/nsXMLHttpRequest.cpp index 27ec5f5c1e..54b29a01c8 100644 --- a/dom/base/nsXMLHttpRequest.cpp +++ b/dom/base/nsXMLHttpRequest.cpp @@ -29,6 +29,12 @@ #include "nsIURI.h" #include "nsILoadGroup.h" #include "nsNetUtil.h" +#include "nsStringStream.h" +#include "nsIAuthPrompt.h" +#include "nsIAuthPrompt2.h" +#include "nsIOutputStream.h" +#include "nsISupportsPrimitives.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsStreamUtils.h" #include "nsThreadUtils.h" #include "nsIUploadChannel.h" diff --git a/dom/base/test/csp/chrome.ini b/dom/base/test/csp/chrome.ini deleted file mode 100644 index 75359e9464..0000000000 --- a/dom/base/test/csp/chrome.ini +++ /dev/null @@ -1,5 +0,0 @@ -[DEFAULT] -skip-if = buildapp == 'b2g' - -[test_csp_bug768029.html] -[test_csp_bug773891.html] diff --git a/dom/base/test/csp/file_CSP_web_manifest.html b/dom/base/test/csp/file_CSP_web_manifest.html deleted file mode 100644 index 83223c24af..0000000000 --- a/dom/base/test/csp/file_CSP_web_manifest.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - - -

Support Page for Web Manifest Tests

\ No newline at end of file diff --git a/dom/base/test/csp/file_CSP_web_manifest_https.html b/dom/base/test/csp/file_CSP_web_manifest_https.html deleted file mode 100644 index 37d6e3eace..0000000000 --- a/dom/base/test/csp/file_CSP_web_manifest_https.html +++ /dev/null @@ -1,4 +0,0 @@ - - - -

Support Page for Web Manifest Tests

\ No newline at end of file diff --git a/dom/base/test/csp/file_bug836922_npolicies.html b/dom/base/test/csp/file_bug836922_npolicies.html deleted file mode 100644 index 3be43948f2..0000000000 --- a/dom/base/test/csp/file_bug836922_npolicies.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - diff --git a/dom/base/test/csp/file_bug886164.html b/dom/base/test/csp/file_bug886164.html deleted file mode 100644 index f6d0b439c9..0000000000 --- a/dom/base/test/csp/file_bug886164.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/dom/base/test/csp/file_bug886164_3.html b/dom/base/test/csp/file_bug886164_3.html deleted file mode 100644 index 175a2ff041..0000000000 --- a/dom/base/test/csp/file_bug886164_3.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/dom/base/test/csp/file_bug886164_4.html b/dom/base/test/csp/file_bug886164_4.html deleted file mode 100644 index abf819441a..0000000000 --- a/dom/base/test/csp/file_bug886164_4.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/dom/base/test/csp/file_csp_allow_https_schemes.html b/dom/base/test/csp/file_csp_allow_https_schemes.html deleted file mode 100644 index 96dab5013a..0000000000 --- a/dom/base/test/csp/file_csp_allow_https_schemes.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - Bug 826805 - CSP: Allow http and https for scheme-less sources - - -
blocked
- - - - diff --git a/dom/base/test/csp/file_csp_bug768029.html b/dom/base/test/csp/file_csp_bug768029.html deleted file mode 100644 index b2f1fe5bbc..0000000000 --- a/dom/base/test/csp/file_csp_bug768029.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - This is an app for testing - - - - - - - - - - - - Test for CSP applied to (simulated) app. - - - diff --git a/dom/base/test/csp/file_csp_bug773891.html b/dom/base/test/csp/file_csp_bug773891.html deleted file mode 100644 index ae2ba8d2fe..0000000000 --- a/dom/base/test/csp/file_csp_bug773891.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - This is an app for csp testing - - - - - - - - - - - - Test for CSP applied to (simulated) app. - - - diff --git a/dom/base/test/csp/file_policyuri_regression_from_multipolicy.html^headers^ b/dom/base/test/csp/file_policyuri_regression_from_multipolicy.html^headers^ deleted file mode 100644 index b57a8447c6..0000000000 --- a/dom/base/test/csp/file_policyuri_regression_from_multipolicy.html^headers^ +++ /dev/null @@ -1 +0,0 @@ -content-security-policy-report-only: policy-uri /tests/dom/base/test/csp/file_CSP_policyuri_regression_from_multipolicy_policy diff --git a/dom/base/test/mixedcontentblocker/mochitest.ini b/dom/base/test/mixedcontentblocker/mochitest.ini deleted file mode 100644 index c118cf462d..0000000000 --- a/dom/base/test/mixedcontentblocker/mochitest.ini +++ /dev/null @@ -1,20 +0,0 @@ -[DEFAULT] -support-files = - bug803225_test_mailto.html - file_mixed_content_frameNavigation.html - file_mixed_content_frameNavigation_blankTarget.html - file_mixed_content_frameNavigation_grandchild.html - file_mixed_content_frameNavigation_innermost.html - file_mixed_content_frameNavigation_secure.html - file_mixed_content_frameNavigation_secure_grandchild.html - file_mixed_content_main.html - file_mixed_content_main_bug803225.html - file_mixed_content_main_bug803225_websocket_wsh.py - file_mixed_content_server.sjs - -[test_mixed_content_blocker.html] -skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s #TIMED_OUT, SSL_REQUIRED # Bug 1141029 Mulet parity with B2G Desktop for TC -[test_mixed_content_blocker_bug803225.html] -skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s #TIMED_OUT, SSL_REQUIRED # Bug 1141029 Mulet parity with B2G Desktop for TC -[test_mixed_content_blocker_frameNavigation.html] -skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e10s #TIMED_OUT, SSL_REQUIRED # Bug 1141029 Mulet parity with B2G Desktop for TC diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index 820c4cfa4b..4b338d791c 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -62,11 +62,6 @@ support-files = eventsource_redirect.resource^headers^ eventsource_redirect_to.resource eventsource_redirect_to.resource^headers^ - file_CrossSiteXHR_cache_server.sjs - file_CrossSiteXHR_inner.html - file_CrossSiteXHR_inner.jar - file_CrossSiteXHR_inner_data.sjs - file_CrossSiteXHR_server.sjs file_XHRDocURI.text file_XHRDocURI.text^headers^ file_XHRDocURI.xml @@ -316,10 +311,6 @@ skip-if = e10s || buildapp == 'b2g' [test_window_named_frame_enumeration.html] [test_writable-replaceable.html] [test_navigatorPrefOverride.html] -[test_CrossSiteXHR.html] -[test_CrossSiteXHR_cache.html] -[test_CrossSiteXHR_origin.html] -skip-if = buildapp == 'b2g' || e10s # last test fails to trigger onload on e10s/b2g [test_EventSource_redirects.html] [test_NodeIterator_basics_filters.xhtml] [test_NodeIterator_mutations_1.xhtml] diff --git a/dom/base/test/moz.build b/dom/base/test/moz.build index e58a412273..9fdfe9ae43 100644 --- a/dom/base/test/moz.build +++ b/dom/base/test/moz.build @@ -10,7 +10,6 @@ XPCSHELL_TESTS_MANIFESTS += [ ] GeckoCppUnitTests([ - 'TestCSPParser', 'TestGetURL', 'TestNativeXMLHttpRequest', 'TestPlainTextSerializer', @@ -18,8 +17,6 @@ GeckoCppUnitTests([ MOCHITEST_MANIFESTS += [ 'chrome/mochitest.ini', - 'csp/mochitest.ini', - 'mixedcontentblocker/mochitest.ini', 'mochitest.ini', 'websocket_hybi/mochitest.ini', ] @@ -34,10 +31,8 @@ if CONFIG['MOZ_CHILD_PERMISSIONS']: MOCHITEST_CHROME_MANIFESTS += [ 'chrome.ini', 'chrome/chrome.ini', - 'csp/chrome.ini', ] BROWSER_CHROME_MANIFESTS += [ 'browser.ini', - 'csp/browser.ini', ] diff --git a/dom/base/test/test_warning_for_blocked_cross_site_request.html b/dom/base/test/test_warning_for_blocked_cross_site_request.html index 50e470dfcd..590506d2ee 100644 --- a/dom/base/test/test_warning_for_blocked_cross_site_request.html +++ b/dom/base/test/test_warning_for_blocked_cross_site_request.html @@ -13,7 +13,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=713980 @@ -76,7 +76,7 @@ function cleanup() { // Send a cross-origin XHR request without CORS var xhr = new XMLHttpRequest(); -xhr.open("GET", "http://example.org/tests/dom/base/test/file_CrossSiteXHR_server.sjs?allowOrigin=http://invalid", true); +xhr.open("GET", "http://example.org/tests/dom/security/test/cors/file_CrossSiteXHR_server.sjs?allowOrigin=http://invalid", true); xhr.send(null); // Create a div that triggers a cross-origin webfont request diff --git a/dom/base/test/unit/xpcshell.ini b/dom/base/test/unit/xpcshell.ini index 309ac44830..287882e565 100644 --- a/dom/base/test/unit/xpcshell.ini +++ b/dom/base/test/unit/xpcshell.ini @@ -23,8 +23,6 @@ support-files = [test_bug553888.js] [test_bug737966.js] -[test_cspreports.js] -skip-if = buildapp == 'mulet' [test_error_codes.js] run-sequentially = Hardcoded 4444 port. # Bug 1018414: hardcoded localhost doesn't work properly on some OS X installs diff --git a/dom/cache/Cache.cpp b/dom/cache/Cache.cpp index c5fcf1c85b..38d4d4ec6b 100644 --- a/dom/cache/Cache.cpp +++ b/dom/cache/Cache.cpp @@ -22,7 +22,6 @@ #include "mozilla/Preferences.h" #include "mozilla/unused.h" #include "nsIGlobalObject.h" -#include "nsNetUtil.h" namespace mozilla { namespace dom { diff --git a/dom/cache/DBAction.cpp b/dom/cache/DBAction.cpp index 0aae9f2327..3120aea503 100644 --- a/dom/cache/DBAction.cpp +++ b/dom/cache/DBAction.cpp @@ -16,7 +16,7 @@ #include "mozStorageCID.h" #include "nsIFile.h" #include "nsIURI.h" -#include "nsNetUtil.h" +#include "nsIFileURL.h" #include "nsThreadUtils.h" namespace mozilla { diff --git a/dom/cache/DBSchema.cpp b/dom/cache/DBSchema.cpp index f7a02a40c2..3769eced10 100644 --- a/dom/cache/DBSchema.cpp +++ b/dom/cache/DBSchema.cpp @@ -19,6 +19,7 @@ #include "nsCRT.h" #include "nsHttp.h" #include "nsICryptoHash.h" +#include "nsNetCID.h" #include "mozilla/BasePrincipal.h" #include "mozilla/dom/HeadersBinding.h" #include "mozilla/dom/RequestBinding.h" diff --git a/dom/cache/FileUtils.cpp b/dom/cache/FileUtils.cpp index 77d8e8cdbc..965a7b99fe 100644 --- a/dom/cache/FileUtils.cpp +++ b/dom/cache/FileUtils.cpp @@ -11,7 +11,8 @@ #include "mozilla/unused.h" #include "nsIFile.h" #include "nsIUUIDGenerator.h" -#include "nsNetUtil.h" +#include "nsNetCID.h" +#include "nsISimpleEnumerator.h" #include "nsServiceManagerUtils.h" #include "nsString.h" #include "nsThreadUtils.h" diff --git a/dom/camera/TestGonkCameraHardware.cpp b/dom/camera/TestGonkCameraHardware.cpp index d3c79e907b..5a945b5e95 100644 --- a/dom/camera/TestGonkCameraHardware.cpp +++ b/dom/camera/TestGonkCameraHardware.cpp @@ -22,8 +22,8 @@ #include "mozilla/dom/ErrorEvent.h" #include "mozilla/dom/CameraFacesDetectedEvent.h" #include "mozilla/dom/CameraStateChangeEvent.h" -#include "DOMCameraDetectedFace.h" #include "nsNetUtil.h" +#include "DOMCameraDetectedFace.h" #include "nsServiceManagerUtils.h" #include "nsICameraTestHardware.h" diff --git a/dom/devicestorage/nsDeviceStorage.cpp b/dom/devicestorage/nsDeviceStorage.cpp index 4ef7f703bd..743282ab32 100644 --- a/dom/devicestorage/nsDeviceStorage.cpp +++ b/dom/devicestorage/nsDeviceStorage.cpp @@ -37,6 +37,7 @@ #include "nsAppDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h" #include "nsNetUtil.h" +#include "nsIOutputStream.h" #include "nsCycleCollectionParticipant.h" #include "nsIPrincipal.h" #include "nsJSUtils.h" diff --git a/dom/fetch/FetchDriver.cpp b/dom/fetch/FetchDriver.cpp index 8df69fbee5..2b772f0f02 100644 --- a/dom/fetch/FetchDriver.cpp +++ b/dom/fetch/FetchDriver.cpp @@ -16,6 +16,8 @@ #include "nsIScriptSecurityManager.h" #include "nsIThreadRetargetableRequest.h" #include "nsIUploadChannel2.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsIPipe.h" #include "nsContentPolicyUtils.h" #include "nsCORSListenerProxy.h" diff --git a/dom/filehandle/FileHandle.cpp b/dom/filehandle/FileHandle.cpp index c1a8edd22f..87455e9860 100644 --- a/dom/filehandle/FileHandle.cpp +++ b/dom/filehandle/FileHandle.cpp @@ -21,6 +21,7 @@ #include "nsIEventTarget.h" #include "nsISeekableStream.h" #include "nsNetUtil.h" +#include "nsIAsyncStreamCopier.h" #include "nsString.h" #include "nsStringStream.h" #include "nsThreadUtils.h" diff --git a/dom/filesystem/CreateFileTask.cpp b/dom/filesystem/CreateFileTask.cpp index ece56f2f9d..042e6d66e8 100644 --- a/dom/filesystem/CreateFileTask.cpp +++ b/dom/filesystem/CreateFileTask.cpp @@ -18,6 +18,7 @@ #include "mozilla/dom/ipc/BlobParent.h" #include "nsIFile.h" #include "nsNetUtil.h" +#include "nsIOutputStream.h" #include "nsStringGlue.h" namespace mozilla { diff --git a/dom/filesystem/FileSystemTaskBase.cpp b/dom/filesystem/FileSystemTaskBase.cpp index 8f52f6b239..83d9a5b265 100644 --- a/dom/filesystem/FileSystemTaskBase.cpp +++ b/dom/filesystem/FileSystemTaskBase.cpp @@ -6,7 +6,7 @@ #include "mozilla/dom/FileSystemTaskBase.h" -#include "nsNetUtil.h" // Stream transport service. +#include "nsNetCID.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/dom/File.h" #include "mozilla/dom/FileSystemBase.h" diff --git a/dom/html/HTMLFormElement.cpp b/dom/html/HTMLFormElement.cpp index c8b045eb67..89a0bcef96 100644 --- a/dom/html/HTMLFormElement.cpp +++ b/dom/html/HTMLFormElement.cpp @@ -43,6 +43,7 @@ #include "nsRange.h" #include "nsIScriptSecurityManager.h" #include "nsNetUtil.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsIWebProgress.h" #include "nsIDocShell.h" #include "nsFormData.h" diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp index b59b80c065..4b80895ecb 100644 --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -17,7 +17,6 @@ #include "nsIURL.h" #include "nsIIOService.h" #include "nsIServiceManager.h" -#include "nsNetUtil.h" #include "nsContentUtils.h" #include "nsContainerFrame.h" #include "nsNodeInfoManager.h" diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 24981a2f29..5c334eaeb0 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -77,6 +77,7 @@ // input type=file #include "mozilla/dom/File.h" #include "nsIFile.h" +#include "nsNetCID.h" #include "nsNetUtil.h" #include "nsDirectoryServiceDefs.h" #include "nsIContentPrefService.h" diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp index d927b334cf..80856beb61 100644 --- a/dom/html/HTMLLinkElement.cpp +++ b/dom/html/HTMLLinkElement.cpp @@ -24,7 +24,6 @@ #include "nsIStyleSheet.h" #include "nsIStyleSheetLinkingElement.h" #include "nsIURL.h" -#include "nsNetUtil.h" #include "nsPIDOMWindow.h" #include "nsReadableUtils.h" #include "nsStyleConsts.h" diff --git a/dom/html/HTMLStyleElement.cpp b/dom/html/HTMLStyleElement.cpp index 7f98bdb91c..4534aaa88d 100644 --- a/dom/html/HTMLStyleElement.cpp +++ b/dom/html/HTMLStyleElement.cpp @@ -9,7 +9,6 @@ #include "nsStyleConsts.h" #include "nsIDOMStyleSheet.h" #include "nsIStyleSheet.h" -#include "nsNetUtil.h" #include "nsIDocument.h" #include "nsUnicharUtils.h" #include "nsThreadUtils.h" diff --git a/dom/html/HTMLVideoElement.cpp b/dom/html/HTMLVideoElement.cpp index 407da37bf8..9b23adecb1 100644 --- a/dom/html/HTMLVideoElement.cpp +++ b/dom/html/HTMLVideoElement.cpp @@ -13,7 +13,6 @@ #include "nsError.h" #include "nsNodeInfoManager.h" #include "plbase64.h" -#include "nsNetUtil.h" #include "nsXPCOMStrings.h" #include "prlock.h" #include "nsThreadUtils.h" diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 4ea3070386..60acef1588 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -37,7 +37,6 @@ #include "nsPIDOMWindow.h" #include "nsIStyleRule.h" #include "nsIURL.h" -#include "nsNetUtil.h" #include "nsEscape.h" #include "nsIFrameInlines.h" #include "nsIScrollableFrame.h" diff --git a/dom/html/nsHTMLContentSink.cpp b/dom/html/nsHTMLContentSink.cpp index 6ffb02108f..6e715508e3 100644 --- a/dom/html/nsHTMLContentSink.cpp +++ b/dom/html/nsHTMLContentSink.cpp @@ -21,7 +21,6 @@ #include "nsIInterfaceRequestorUtils.h" #include "nsScriptLoader.h" #include "nsIURI.h" -#include "nsNetUtil.h" #include "nsIContentViewer.h" #include "mozilla/dom/NodeInfo.h" #include "nsToken.h" diff --git a/dom/html/nsHTMLDNSPrefetch.cpp b/dom/html/nsHTMLDNSPrefetch.cpp index 95f140e430..09d281b9be 100644 --- a/dom/html/nsHTMLDNSPrefetch.cpp +++ b/dom/html/nsHTMLDNSPrefetch.cpp @@ -14,6 +14,8 @@ #include "nsString.h" #include "nsNetUtil.h" +#include "nsNetCID.h" +#include "nsIProtocolHandler.h" #include "nsIDNSListener.h" #include "nsIWebProgressListener.h" diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index 6579131082..1a53cbcb03 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -31,6 +31,7 @@ #include "nsIURI.h" #include "nsIIOService.h" #include "nsNetUtil.h" +#include "nsIPrivateBrowsingChannel.h" #include "nsIContentViewerContainer.h" #include "nsIContentViewer.h" #include "nsDocShell.h" diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 52f788070d..059df36e09 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -60,6 +60,7 @@ #include "nsEscape.h" #include "nsHashKeys.h" #include "nsNetUtil.h" +#include "nsISimpleEnumerator.h" #include "nsIAppsService.h" #include "nsIEventTarget.h" #include "nsIFile.h" diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 1949a98ac1..e645ef603e 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -121,6 +121,7 @@ #include "nsIObserverService.h" #include "nsIPresShell.h" #include "nsIScriptError.h" +#include "nsIScriptSecurityManager.h" #include "nsISiteSecurityService.h" #include "nsISpellChecker.h" #include "nsIStyleSheet.h" diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index d76198a4f9..7848c88441 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -89,6 +89,7 @@ #include "gfxPrefs.h" #include "nsILoginManagerPrompter.h" #include "nsPIWindowRoot.h" +#include "nsIAuthPrompt2.h" #include "gfxDrawable.h" #include "ImageOps.h" #include "UnitTransforms.h" diff --git a/dom/json/nsJSON.cpp b/dom/json/nsJSON.cpp index 32f35fa83a..118ee51dac 100644 --- a/dom/json/nsJSON.cpp +++ b/dom/json/nsJSON.cpp @@ -17,6 +17,8 @@ #include "nsIUnicodeDecoder.h" #include "nsXPCOMStrings.h" #include "nsNetUtil.h" +#include "nsIURI.h" +#include "nsComponentManagerUtils.h" #include "nsContentUtils.h" #include "nsIScriptError.h" #include "nsCRTGlue.h" diff --git a/dom/jsurl/nsJSProtocolHandler.cpp b/dom/jsurl/nsJSProtocolHandler.cpp index 75a41e7f87..82417dcb9c 100644 --- a/dom/jsurl/nsJSProtocolHandler.cpp +++ b/dom/jsurl/nsJSProtocolHandler.cpp @@ -16,6 +16,7 @@ #include "nsStringStream.h" #include "nsNetUtil.h" +#include "nsIStreamListener.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" #include "nsIURI.h" diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index ee015df306..5189d23093 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -24,6 +24,7 @@ #include "nsISupportsPrimitives.h" #include "nsIInterfaceRequestorUtils.h" #include "nsIIDNService.h" +#include "nsNetCID.h" #include "nsNetUtil.h" #include "nsPrincipal.h" #include "nsICryptoHash.h" diff --git a/dom/media/systemservices/LoadManager.cpp b/dom/media/systemservices/LoadManager.cpp index cbafae34dd..5d5a1ce02b 100644 --- a/dom/media/systemservices/LoadManager.cpp +++ b/dom/media/systemservices/LoadManager.cpp @@ -14,7 +14,6 @@ #include "nsString.h" #include "nsThreadUtils.h" #include "nsReadableUtils.h" -#include "nsNetUtil.h" #include "nsIObserverService.h" // NSPR_LOG_MODULES=LoadManager:5 diff --git a/dom/media/systemservices/LoadMonitor.cpp b/dom/media/systemservices/LoadMonitor.cpp index d5ba1174b7..f18cdf9153 100644 --- a/dom/media/systemservices/LoadMonitor.cpp +++ b/dom/media/systemservices/LoadMonitor.cpp @@ -16,6 +16,8 @@ #include "nsThreadUtils.h" #include "nsReadableUtils.h" #include "nsNetUtil.h" +#include "nsIInputStream.h" +#include "nsIFile.h" #include "nsILineInputStream.h" #include "nsIObserverService.h" #include "nsIServiceManager.h" diff --git a/dom/media/systemservices/MediaParent.cpp b/dom/media/systemservices/MediaParent.cpp index a48252fb15..06c2a90c05 100644 --- a/dom/media/systemservices/MediaParent.cpp +++ b/dom/media/systemservices/MediaParent.cpp @@ -13,8 +13,11 @@ #include "MediaEngine.h" #include "VideoUtils.h" #include "nsThreadUtils.h" +#include "nsNetCID.h" #include "nsNetUtil.h" +#include "nsIOutputStream.h" #include "nsILineInputStream.h" +#include "nsISafeOutputStream.h" #include "nsAppDirectoryServiceDefs.h" #include "nsISupportsImpl.h" #include "mozilla/Logging.h" diff --git a/dom/media/webaudio/AudioContext.cpp b/dom/media/webaudio/AudioContext.cpp index ae99809ccd..2288f6c511 100644 --- a/dom/media/webaudio/AudioContext.cpp +++ b/dom/media/webaudio/AudioContext.cpp @@ -35,6 +35,7 @@ #include "PeriodicWave.h" #include "ConvolverNode.h" #include "OscillatorNode.h" +#include "nsNetCID.h" #include "nsNetUtil.h" #include "AudioStream.h" #include "mozilla/dom/Promise.h" diff --git a/dom/network/TCPServerSocketParent.cpp b/dom/network/TCPServerSocketParent.cpp index d465e58d0d..a3ac6a1447 100644 --- a/dom/network/TCPServerSocketParent.cpp +++ b/dom/network/TCPServerSocketParent.cpp @@ -4,6 +4,7 @@ * License, v. 2.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 "nsIScriptSecurityManager.h" #include "TCPServerSocketParent.h" #include "nsJSUtils.h" #include "TCPSocketParent.h" diff --git a/dom/network/TCPSocketParent.cpp b/dom/network/TCPSocketParent.cpp index d3cf7a5a24..a238bdb631 100644 --- a/dom/network/TCPSocketParent.cpp +++ b/dom/network/TCPSocketParent.cpp @@ -18,6 +18,7 @@ #include "mozilla/dom/TabParent.h" #include "mozilla/HoldDropJSObjects.h" #include "nsIScriptSecurityManager.h" +#include "nsNetUtil.h" namespace IPC { diff --git a/dom/offline/nsDOMOfflineResourceList.cpp b/dom/offline/nsDOMOfflineResourceList.cpp index 558315d6d5..2bcf93a797 100644 --- a/dom/offline/nsDOMOfflineResourceList.cpp +++ b/dom/offline/nsDOMOfflineResourceList.cpp @@ -13,6 +13,8 @@ #include "nsCPrefetchService.h" #include "nsNetUtil.h" #include "nsNetCID.h" +#include "nsServiceManagerUtils.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsIOfflineCacheUpdate.h" #include "nsAutoPtr.h" #include "nsContentUtils.h" diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 51e1b0760d..5f0319ec5f 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -72,6 +72,7 @@ #include "nsIDocShell.h" #include "nsNetUtil.h" +#include "nsNetCID.h" #include "mozilla/Mutex.h" #include "mozilla/PluginLibrary.h" diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index 252f611cc8..518c8d0e85 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -38,6 +38,9 @@ #endif #include "nsISeekableStream.h" #include "nsNetUtil.h" +#include "nsIFileStreams.h" +#include "nsISimpleEnumerator.h" +#include "nsIStringStream.h" #include "nsIProgressEventSink.h" #include "nsIDocument.h" #include "nsPluginLogging.h" diff --git a/dom/security/moz.build b/dom/security/moz.build index b994949b79..5b31185583 100644 --- a/dom/security/moz.build +++ b/dom/security/moz.build @@ -4,6 +4,8 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. +TEST_DIRS += ['test'] + EXPORTS.mozilla.dom += [ 'nsCSPContext.h', 'nsCSPService.h', diff --git a/dom/security/nsCORSListenerProxy.cpp b/dom/security/nsCORSListenerProxy.cpp index 5da91b8bb9..fc8fa90db1 100644 --- a/dom/security/nsCORSListenerProxy.cpp +++ b/dom/security/nsCORSListenerProxy.cpp @@ -15,6 +15,8 @@ #include "nsContentUtils.h" #include "nsIScriptSecurityManager.h" #include "nsNetUtil.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsServiceManagerUtils.h" #include "nsMimeTypes.h" #include "nsIStreamConverterService.h" #include "nsStringStream.h" diff --git a/dom/security/nsCSPContext.h b/dom/security/nsCSPContext.h index 61ca58aa43..e1d4c7b90c 100644 --- a/dom/security/nsCSPContext.h +++ b/dom/security/nsCSPContext.h @@ -16,7 +16,7 @@ #include "nsIInterfaceRequestor.h" #include "nsISerializable.h" #include "nsIStreamListener.h" -#include "nsWeakPtr.h" +#include "nsWeakReference.h" #include "nsXPCOM.h" #define NS_CSPCONTEXT_CONTRACTID "@mozilla.org/cspcontext;1" diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp index bc06ae1346..595a990e28 100644 --- a/dom/security/nsCSPUtils.cpp +++ b/dom/security/nsCSPUtils.cpp @@ -11,7 +11,7 @@ #include "nsIScriptError.h" #include "nsIServiceManager.h" #include "nsIStringBundle.h" -#include "nsNetUtil.h" +#include "nsIURL.h" #include "nsReadableUtils.h" #define DEFAULT_PORT -1 diff --git a/dom/security/nsMixedContentBlocker.cpp b/dom/security/nsMixedContentBlocker.cpp index 8ecc392c5d..9b886c0ea3 100644 --- a/dom/security/nsMixedContentBlocker.cpp +++ b/dom/security/nsMixedContentBlocker.cpp @@ -14,7 +14,6 @@ #include "nsISecurityEventSink.h" #include "nsIWebProgressListener.h" #include "nsContentUtils.h" -#include "nsNetUtil.h" #include "nsIRequest.h" #include "nsIDocument.h" #include "nsIContentViewer.h" diff --git a/dom/base/test/TestCSPParser.cpp b/dom/security/test/TestCSPParser.cpp similarity index 100% rename from dom/base/test/TestCSPParser.cpp rename to dom/security/test/TestCSPParser.cpp diff --git a/dom/base/test/file_CrossSiteXHR_cache_server.sjs b/dom/security/test/cors/file_CrossSiteXHR_cache_server.sjs similarity index 89% rename from dom/base/test/file_CrossSiteXHR_cache_server.sjs rename to dom/security/test/cors/file_CrossSiteXHR_cache_server.sjs index 5da6bf663e..f56f512e15 100644 --- a/dom/base/test/file_CrossSiteXHR_cache_server.sjs +++ b/dom/security/test/cors/file_CrossSiteXHR_cache_server.sjs @@ -7,7 +7,7 @@ function handleRequest(request, response) }); if ("setState" in query) { - setState("test/dom/base/test_CrossSiteXHR_cache:secData", + setState("test/dom/security/test_CrossSiteXHR_cache:secData", query.setState); response.setHeader("Cache-Control", "no-cache", false); @@ -22,7 +22,7 @@ function handleRequest(request, response) // Send response secData = - eval(getState("test/dom/base/test_CrossSiteXHR_cache:secData")); + eval(getState("test/dom/security/test_CrossSiteXHR_cache:secData")); if (secData.allowOrigin) response.setHeader("Access-Control-Allow-Origin", secData.allowOrigin); diff --git a/dom/base/test/file_CrossSiteXHR_inner.html b/dom/security/test/cors/file_CrossSiteXHR_inner.html similarity index 100% rename from dom/base/test/file_CrossSiteXHR_inner.html rename to dom/security/test/cors/file_CrossSiteXHR_inner.html diff --git a/dom/base/test/file_CrossSiteXHR_inner.jar b/dom/security/test/cors/file_CrossSiteXHR_inner.jar similarity index 100% rename from dom/base/test/file_CrossSiteXHR_inner.jar rename to dom/security/test/cors/file_CrossSiteXHR_inner.jar diff --git a/dom/base/test/file_CrossSiteXHR_inner_data.sjs b/dom/security/test/cors/file_CrossSiteXHR_inner_data.sjs similarity index 100% rename from dom/base/test/file_CrossSiteXHR_inner_data.sjs rename to dom/security/test/cors/file_CrossSiteXHR_inner_data.sjs diff --git a/dom/base/test/file_CrossSiteXHR_server.sjs b/dom/security/test/cors/file_CrossSiteXHR_server.sjs similarity index 98% rename from dom/base/test/file_CrossSiteXHR_server.sjs rename to dom/security/test/cors/file_CrossSiteXHR_server.sjs index cbf042040e..a2b7cafb33 100644 --- a/dom/base/test/file_CrossSiteXHR_server.sjs +++ b/dom/security/test/cors/file_CrossSiteXHR_server.sjs @@ -138,7 +138,7 @@ function handleRequest(request, response) if (query.hop && query.hop < hops.length) { newURL = hops[query.hop].server + - "/tests/dom/base/test/file_CrossSiteXHR_server.sjs?" + + "/tests/dom/security/test/cors/file_CrossSiteXHR_server.sjs?" + "hop=" + (query.hop + 1) + "&hops=" + query.hops; response.setStatusLine(null, 307, "redirect"); response.setHeader("Location", newURL); diff --git a/dom/security/test/cors/mochitest.ini b/dom/security/test/cors/mochitest.ini new file mode 100644 index 0000000000..0dbba8be52 --- /dev/null +++ b/dom/security/test/cors/mochitest.ini @@ -0,0 +1,12 @@ +[DEFAULT] +support-files = + file_CrossSiteXHR_cache_server.sjs + file_CrossSiteXHR_inner.html + file_CrossSiteXHR_inner.jar + file_CrossSiteXHR_inner_data.sjs + file_CrossSiteXHR_server.sjs + +[test_CrossSiteXHR.html] +[test_CrossSiteXHR_cache.html] +[test_CrossSiteXHR_origin.html] +skip-if = buildapp == 'b2g' || e10s # last test fails to trigger onload on e10s/b2g diff --git a/dom/base/test/test_CrossSiteXHR.html b/dom/security/test/cors/test_CrossSiteXHR.html similarity index 99% rename from dom/base/test/test_CrossSiteXHR.html rename to dom/security/test/cors/test_CrossSiteXHR.html index d80d078f98..fe7bfcfbe6 100644 --- a/dom/base/test/test_CrossSiteXHR.html +++ b/dom/security/test/cors/test_CrossSiteXHR.html @@ -44,11 +44,11 @@ function runTest() { loader.onload = function () { gen.next() }; // Test preflight-less requests - basePath = "/tests/dom/base/test/file_CrossSiteXHR_server.sjs?" + basePath = "/tests/dom/security/test/cors/file_CrossSiteXHR_server.sjs?" baseURL = "http://mochi.test:8888" + basePath; // Test preflighted requests - loader.src = "http://example.org/tests/dom/base/test/file_CrossSiteXHR_inner.html"; + loader.src = "http://example.org/tests/dom/security/test/cors/file_CrossSiteXHR_inner.html"; origin = "http://example.org"; yield undefined; @@ -874,7 +874,7 @@ function runTest() { // Test redirects - is(loader.src, "http://example.org/tests/dom/base/test/file_CrossSiteXHR_inner.html"); + is(loader.src, "http://example.org/tests/dom/security/test/cors/file_CrossSiteXHR_inner.html"); is(origin, "http://example.org"); tests = [{ pass: 1, diff --git a/dom/base/test/test_CrossSiteXHR_cache.html b/dom/security/test/cors/test_CrossSiteXHR_cache.html similarity index 98% rename from dom/base/test/test_CrossSiteXHR_cache.html rename to dom/security/test/cors/test_CrossSiteXHR_cache.html index 77371044f3..bcd74b9d90 100644 --- a/dom/base/test/test_CrossSiteXHR_cache.html +++ b/dom/security/test/cors/test_CrossSiteXHR_cache.html @@ -30,7 +30,7 @@ function runTest() { var loaderWindow = loader.contentWindow; loader.onload = function () { gen.next() }; - loader.src = "http://example.org/tests/dom/base/test/file_CrossSiteXHR_inner.html"; + loader.src = "http://example.org/tests/dom/security/test/cors/file_CrossSiteXHR_inner.html"; origin = "http://example.org"; yield undefined; @@ -428,7 +428,7 @@ function runTest() { }); } - baseURL = "http://mochi.test:8888/tests/dom/base/test/" + + baseURL = "http://mochi.test:8888/tests/dom/security/test/cors/" + "file_CrossSiteXHR_cache_server.sjs?"; setStateURL = baseURL + "setState="; diff --git a/dom/base/test/test_CrossSiteXHR_origin.html b/dom/security/test/cors/test_CrossSiteXHR_origin.html similarity index 92% rename from dom/base/test/test_CrossSiteXHR_origin.html rename to dom/security/test/cors/test_CrossSiteXHR_origin.html index 09fd81502b..95fe7f21c4 100644 --- a/dom/base/test/test_CrossSiteXHR_origin.html +++ b/dom/security/test/cors/test_CrossSiteXHR_origin.html @@ -39,10 +39,10 @@ var origins = origin: 'http://xn--hxajbheg2az3al.xn--jxalpdlp' }, { origin: 'http://example.org', - file: 'jar:http://example.org/tests/dom/base/test/file_CrossSiteXHR_inner.jar!/file_CrossSiteXHR_inner.html' + file: 'jar:http://example.org/tests/dom/security/test/cors/file_CrossSiteXHR_inner.jar!/file_CrossSiteXHR_inner.html' }, { origin: 'null', - file: 'http://example.org/tests/dom/base/test/file_CrossSiteXHR_inner_data.sjs' + file: 'http://example.org/tests/dom/security/test/cors/file_CrossSiteXHR_inner_data.sjs' }, ]; @@ -61,14 +61,14 @@ function runTest() { loader.onload = function () { gen.next() }; // Test preflight-less requests - basePath = "/tests/dom/base/test/file_CrossSiteXHR_server.sjs?" + basePath = "/tests/dom/security/test/cors/file_CrossSiteXHR_server.sjs?" baseURL = "http://mochi.test:8888" + basePath; for (originEntry of origins) { origin = originEntry.origin || originEntry.server; loader.src = originEntry.file || - (originEntry.server + "/tests/dom/base/test/file_CrossSiteXHR_inner.html"); + (originEntry.server + "/tests/dom/security/test/cors/file_CrossSiteXHR_inner.html"); yield undefined; var isNullOrigin = origin == "null"; diff --git a/dom/base/test/csp/browser.ini b/dom/security/test/csp/browser.ini similarity index 100% rename from dom/base/test/csp/browser.ini rename to dom/security/test/csp/browser.ini diff --git a/dom/base/test/csp/browser_test_web_manifest.js b/dom/security/test/csp/browser_test_web_manifest.js similarity index 95% rename from dom/base/test/csp/browser_test_web_manifest.js rename to dom/security/test/csp/browser_test_web_manifest.js index ca12d60ad8..118f6fa28f 100644 --- a/dom/base/test/csp/browser_test_web_manifest.js +++ b/dom/security/test/csp/browser_test_web_manifest.js @@ -11,12 +11,12 @@ requestLongerTimeout(10); // e10s tests take time. const { ManifestObtainer } = Components.utils.import('resource://gre/modules/WebManifest.jsm', {}); -const path = '/tests/dom/base/test/csp/'; -const testFile = `file=${path}file_CSP_web_manifest.html`; -const remoteFile = `file=${path}file_CSP_web_manifest_remote.html`; -const httpsManifest = `file=${path}file_CSP_web_manifest_https.html`; -const mixedContent = `file=${path}file_CSP_web_manifest_mixed_content.html`; -const server = 'file_csp_testserver.sjs'; +const path = '/tests/dom/security/test/csp/'; +const testFile = `file=${path}file_web_manifest.html`; +const remoteFile = `file=${path}file_web_manifest_remote.html`; +const httpsManifest = `file=${path}file_web_manifest_https.html`; +const mixedContent = `file=${path}file_web_manifest_mixed_content.html`; +const server = 'file_testserver.sjs'; const defaultURL = `http://example.org${path}${server}`; const remoteURL = `http://mochi.test:8888`; const secureURL = `https://example.com${path}${server}`; diff --git a/dom/base/test/csp/browser_test_web_manifest_mixed_content.js b/dom/security/test/csp/browser_test_web_manifest_mixed_content.js similarity index 83% rename from dom/base/test/csp/browser_test_web_manifest_mixed_content.js rename to dom/security/test/csp/browser_test_web_manifest_mixed_content.js index c4f3b738b1..b7d1b7b688 100644 --- a/dom/base/test/csp/browser_test_web_manifest_mixed_content.js +++ b/dom/security/test/csp/browser_test_web_manifest_mixed_content.js @@ -7,12 +7,12 @@ const { ManifestObtainer } = Components.utils.import('resource://gre/modules/WebManifest.jsm', {}); -const path = '/tests/dom/base/test/csp/'; -const mixedContent = `file=${path}file_CSP_web_manifest_mixed_content.html`; -const server = 'file_csp_testserver.sjs'; +const path = '/tests/dom/security/test/csp/'; +const mixedContent = `file=${path}file_web_manifest_mixed_content.html`; +const server = 'file_testserver.sjs'; const secureURL = `https://example.com${path}${server}`; const tests = [ - // Trying to load mixed content in file_CSP_web_manifest_mixed_content.html + // Trying to load mixed content in file_web_manifest_mixed_content.html // needs to result in an error. { expected: `Mixed Content Blocker prevents fetching manifest.`, diff --git a/dom/security/test/csp/chrome.ini b/dom/security/test/csp/chrome.ini new file mode 100644 index 0000000000..92862ebd6b --- /dev/null +++ b/dom/security/test/csp/chrome.ini @@ -0,0 +1,5 @@ +[DEFAULT] +skip-if = buildapp == 'b2g' + +[test_bug768029.html] +[test_bug773891.html] diff --git a/dom/base/test/csp/file_CSP.css b/dom/security/test/csp/file_CSP.css similarity index 82% rename from dom/base/test/csp/file_CSP.css rename to dom/security/test/csp/file_CSP.css index 35fcd6f5fd..6835c4d4ad 100644 --- a/dom/base/test/csp/file_CSP.css +++ b/dom/security/test/csp/file_CSP.css @@ -12,7 +12,7 @@ } @font-face { font-family: "arbitrary_bad"; - src: url('http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=font_bad&type=application/octet-stream'); + src: url('http://example.org/tests/dom/security/test/csp/file_CSP.sjs?testid=font_bad&type=application/octet-stream'); } .div_arbitrary_good { font-family: "arbitrary_good"; } diff --git a/dom/base/test/csp/file_CSP.sjs b/dom/security/test/csp/file_CSP.sjs similarity index 100% rename from dom/base/test/csp/file_CSP.sjs rename to dom/security/test/csp/file_CSP.sjs diff --git a/dom/security/test/csp/file_allow_https_schemes.html b/dom/security/test/csp/file_allow_https_schemes.html new file mode 100644 index 0000000000..787e683e87 --- /dev/null +++ b/dom/security/test/csp/file_allow_https_schemes.html @@ -0,0 +1,14 @@ + + + + Bug 826805 - CSP: Allow http and https for scheme-less sources + + +
blocked
+ + + + diff --git a/dom/base/test/csp/file_base-uri.html b/dom/security/test/csp/file_base-uri.html similarity index 100% rename from dom/base/test/csp/file_base-uri.html rename to dom/security/test/csp/file_base-uri.html diff --git a/dom/security/test/csp/file_blob_data_schemes.html b/dom/security/test/csp/file_blob_data_schemes.html new file mode 100644 index 0000000000..0a4a491606 --- /dev/null +++ b/dom/security/test/csp/file_blob_data_schemes.html @@ -0,0 +1,49 @@ + + + + Bug 1086999 - Wildcard should not match blob:, data: + + + + + diff --git a/dom/base/test/csp/file_CSP_bug663567.xsl b/dom/security/test/csp/file_bug663567.xsl similarity index 100% rename from dom/base/test/csp/file_CSP_bug663567.xsl rename to dom/security/test/csp/file_bug663567.xsl diff --git a/dom/base/test/csp/file_CSP_bug663567_allows.xml b/dom/security/test/csp/file_bug663567_allows.xml similarity index 86% rename from dom/base/test/csp/file_CSP_bug663567_allows.xml rename to dom/security/test/csp/file_bug663567_allows.xml index 8abeb47127..93d3451038 100644 --- a/dom/base/test/csp/file_CSP_bug663567_allows.xml +++ b/dom/security/test/csp/file_bug663567_allows.xml @@ -1,5 +1,5 @@ - + Empire Burlesque diff --git a/dom/base/test/csp/file_CSP_bug663567_allows.xml^headers^ b/dom/security/test/csp/file_bug663567_allows.xml^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_bug663567_allows.xml^headers^ rename to dom/security/test/csp/file_bug663567_allows.xml^headers^ diff --git a/dom/base/test/csp/file_CSP_bug663567_blocks.xml b/dom/security/test/csp/file_bug663567_blocks.xml similarity index 86% rename from dom/base/test/csp/file_CSP_bug663567_blocks.xml rename to dom/security/test/csp/file_bug663567_blocks.xml index 8abeb47127..93d3451038 100644 --- a/dom/base/test/csp/file_CSP_bug663567_blocks.xml +++ b/dom/security/test/csp/file_bug663567_blocks.xml @@ -1,5 +1,5 @@ - + Empire Burlesque diff --git a/dom/base/test/csp/file_CSP_bug663567_blocks.xml^headers^ b/dom/security/test/csp/file_bug663567_blocks.xml^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_bug663567_blocks.xml^headers^ rename to dom/security/test/csp/file_bug663567_blocks.xml^headers^ diff --git a/dom/security/test/csp/file_bug768029.html b/dom/security/test/csp/file_bug768029.html new file mode 100644 index 0000000000..b349d73ee1 --- /dev/null +++ b/dom/security/test/csp/file_bug768029.html @@ -0,0 +1,25 @@ + + + + + + This is an app for testing + + + + + + + + + + + + Test for CSP applied to (simulated) app. + + + diff --git a/dom/base/test/csp/file_csp_bug768029.sjs b/dom/security/test/csp/file_bug768029.sjs similarity index 100% rename from dom/base/test/csp/file_csp_bug768029.sjs rename to dom/security/test/csp/file_bug768029.sjs diff --git a/dom/security/test/csp/file_bug773891.html b/dom/security/test/csp/file_bug773891.html new file mode 100644 index 0000000000..748169a20e --- /dev/null +++ b/dom/security/test/csp/file_bug773891.html @@ -0,0 +1,25 @@ + + + + + + This is an app for csp testing + + + + + + + + + + + + Test for CSP applied to (simulated) app. + + + diff --git a/dom/base/test/csp/file_csp_bug773891.sjs b/dom/security/test/csp/file_bug773891.sjs similarity index 100% rename from dom/base/test/csp/file_csp_bug773891.sjs rename to dom/security/test/csp/file_bug773891.sjs diff --git a/dom/base/test/csp/file_CSP_bug802872.html b/dom/security/test/csp/file_bug802872.html similarity index 83% rename from dom/base/test/csp/file_CSP_bug802872.html rename to dom/security/test/csp/file_bug802872.html index a163adcc48..dc7129b0cf 100644 --- a/dom/base/test/csp/file_CSP_bug802872.html +++ b/dom/security/test/csp/file_bug802872.html @@ -7,6 +7,6 @@ - + diff --git a/dom/base/test/csp/file_CSP_bug802872.html^headers^ b/dom/security/test/csp/file_bug802872.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_bug802872.html^headers^ rename to dom/security/test/csp/file_bug802872.html^headers^ diff --git a/dom/base/test/csp/file_CSP_bug802872.js b/dom/security/test/csp/file_bug802872.js similarity index 93% rename from dom/base/test/csp/file_CSP_bug802872.js rename to dom/security/test/csp/file_bug802872.js index febea0c855..5df8086cc7 100644 --- a/dom/base/test/csp/file_CSP_bug802872.js +++ b/dom/security/test/csp/file_bug802872.js @@ -8,7 +8,7 @@ function createAllowedEvent() { * Creates a new EventSource using 'http://mochi.test:8888'. Since all mochitests run on * 'http://mochi.test', a default-src of 'self' allows this request. */ - var src_event = new EventSource("http://mochi.test:8888/tests/dom/base/test/csp/file_CSP_bug802872.sjs"); + var src_event = new EventSource("http://mochi.test:8888/tests/dom/security/test/csp/file_bug802872.sjs"); src_event.onmessage = function(e) { src_event.close(); @@ -26,7 +26,7 @@ function createBlockedEvent() { * creates a new EventSource using 'http://example.com'. This domain is not whitelisted by the * CSP of this page, therefore the CSP blocks this request. */ - var src_event = new EventSource("http://example.com/tests/dom/base/test/csp/file_CSP_bug802872.sjs"); + var src_event = new EventSource("http://example.com/tests/dom/security/test/csp/file_bug802872.sjs"); src_event.onmessage = function(e) { src_event.close(); diff --git a/dom/base/test/csp/file_CSP_bug802872.sjs b/dom/security/test/csp/file_bug802872.sjs similarity index 100% rename from dom/base/test/csp/file_CSP_bug802872.sjs rename to dom/security/test/csp/file_bug802872.sjs diff --git a/dom/security/test/csp/file_bug836922_npolicies.html b/dom/security/test/csp/file_bug836922_npolicies.html new file mode 100644 index 0000000000..bbb75b1606 --- /dev/null +++ b/dom/security/test/csp/file_bug836922_npolicies.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + + diff --git a/dom/base/test/csp/file_bug836922_npolicies.html^headers^ b/dom/security/test/csp/file_bug836922_npolicies.html^headers^ similarity index 54% rename from dom/base/test/csp/file_bug836922_npolicies.html^headers^ rename to dom/security/test/csp/file_bug836922_npolicies.html^headers^ index ecff5ff50d..ec6ba8c4ae 100644 --- a/dom/base/test/csp/file_bug836922_npolicies.html^headers^ +++ b/dom/security/test/csp/file_bug836922_npolicies.html^headers^ @@ -1,2 +1,2 @@ -content-security-policy: default-src 'self'; img-src 'none'; report-uri http://mochi.test:8888/tests/dom/base/test/csp/file_bug836922_npolicies_violation.sjs -content-security-policy-report-only: default-src *; img-src 'self'; script-src 'none'; report-uri http://mochi.test:8888/tests/dom/base/test/csp/file_bug836922_npolicies_ro_violation.sjs +content-security-policy: default-src 'self'; img-src 'none'; report-uri http://mochi.test:8888/tests/dom/security/test/csp/file_bug836922_npolicies_violation.sjs +content-security-policy-report-only: default-src *; img-src 'self'; script-src 'none'; report-uri http://mochi.test:8888/tests/dom/security/test/csp/file_bug836922_npolicies_ro_violation.sjs diff --git a/dom/base/test/csp/file_bug836922_npolicies_ro_violation.sjs b/dom/security/test/csp/file_bug836922_npolicies_ro_violation.sjs similarity index 100% rename from dom/base/test/csp/file_bug836922_npolicies_ro_violation.sjs rename to dom/security/test/csp/file_bug836922_npolicies_ro_violation.sjs diff --git a/dom/base/test/csp/file_bug836922_npolicies_violation.sjs b/dom/security/test/csp/file_bug836922_npolicies_violation.sjs similarity index 100% rename from dom/base/test/csp/file_bug836922_npolicies_violation.sjs rename to dom/security/test/csp/file_bug836922_npolicies_violation.sjs diff --git a/dom/base/test/csp/file_CSP_bug885433_allows.html b/dom/security/test/csp/file_bug885433_allows.html similarity index 100% rename from dom/base/test/csp/file_CSP_bug885433_allows.html rename to dom/security/test/csp/file_bug885433_allows.html diff --git a/dom/base/test/csp/file_CSP_bug885433_allows.html^headers^ b/dom/security/test/csp/file_bug885433_allows.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_bug885433_allows.html^headers^ rename to dom/security/test/csp/file_bug885433_allows.html^headers^ diff --git a/dom/base/test/csp/file_CSP_bug885433_blocks.html b/dom/security/test/csp/file_bug885433_blocks.html similarity index 100% rename from dom/base/test/csp/file_CSP_bug885433_blocks.html rename to dom/security/test/csp/file_bug885433_blocks.html diff --git a/dom/base/test/csp/file_CSP_bug885433_blocks.html^headers^ b/dom/security/test/csp/file_bug885433_blocks.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_bug885433_blocks.html^headers^ rename to dom/security/test/csp/file_bug885433_blocks.html^headers^ diff --git a/dom/security/test/csp/file_bug886164.html b/dom/security/test/csp/file_bug886164.html new file mode 100644 index 0000000000..ec8c9e7e92 --- /dev/null +++ b/dom/security/test/csp/file_bug886164.html @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/dom/base/test/csp/file_bug886164.html^headers^ b/dom/security/test/csp/file_bug886164.html^headers^ similarity index 100% rename from dom/base/test/csp/file_bug886164.html^headers^ rename to dom/security/test/csp/file_bug886164.html^headers^ diff --git a/dom/base/test/csp/file_bug886164_2.html b/dom/security/test/csp/file_bug886164_2.html similarity index 53% rename from dom/base/test/csp/file_bug886164_2.html rename to dom/security/test/csp/file_bug886164_2.html index c94dac8144..83d36c55ae 100644 --- a/dom/base/test/csp/file_bug886164_2.html +++ b/dom/security/test/csp/file_bug886164_2.html @@ -5,10 +5,10 @@ - + - + diff --git a/dom/base/test/csp/file_bug886164_2.html^headers^ b/dom/security/test/csp/file_bug886164_2.html^headers^ similarity index 100% rename from dom/base/test/csp/file_bug886164_2.html^headers^ rename to dom/security/test/csp/file_bug886164_2.html^headers^ diff --git a/dom/security/test/csp/file_bug886164_3.html b/dom/security/test/csp/file_bug886164_3.html new file mode 100644 index 0000000000..8b4313000f --- /dev/null +++ b/dom/security/test/csp/file_bug886164_3.html @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/dom/base/test/csp/file_bug886164_3.html^headers^ b/dom/security/test/csp/file_bug886164_3.html^headers^ similarity index 100% rename from dom/base/test/csp/file_bug886164_3.html^headers^ rename to dom/security/test/csp/file_bug886164_3.html^headers^ diff --git a/dom/security/test/csp/file_bug886164_4.html b/dom/security/test/csp/file_bug886164_4.html new file mode 100644 index 0000000000..41137ea017 --- /dev/null +++ b/dom/security/test/csp/file_bug886164_4.html @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/dom/base/test/csp/file_bug886164_4.html^headers^ b/dom/security/test/csp/file_bug886164_4.html^headers^ similarity index 100% rename from dom/base/test/csp/file_bug886164_4.html^headers^ rename to dom/security/test/csp/file_bug886164_4.html^headers^ diff --git a/dom/base/test/csp/file_bug886164_5.html b/dom/security/test/csp/file_bug886164_5.html similarity index 62% rename from dom/base/test/csp/file_bug886164_5.html rename to dom/security/test/csp/file_bug886164_5.html index daa535e579..ae65171a5f 100644 --- a/dom/base/test/csp/file_bug886164_5.html +++ b/dom/security/test/csp/file_bug886164_5.html @@ -18,9 +18,9 @@ - - - - + + + + diff --git a/dom/base/test/csp/file_bug886164_5.html^headers^ b/dom/security/test/csp/file_bug886164_5.html^headers^ similarity index 100% rename from dom/base/test/csp/file_bug886164_5.html^headers^ rename to dom/security/test/csp/file_bug886164_5.html^headers^ diff --git a/dom/base/test/csp/file_bug886164_6.html b/dom/security/test/csp/file_bug886164_6.html similarity index 83% rename from dom/base/test/csp/file_bug886164_6.html rename to dom/security/test/csp/file_bug886164_6.html index 9b1d18a9e1..f985ec8ce6 100644 --- a/dom/base/test/csp/file_bug886164_6.html +++ b/dom/security/test/csp/file_bug886164_6.html @@ -21,8 +21,8 @@ I am sandboxed but with "allow-scripts" - - + +
First name: diff --git a/dom/base/test/csp/file_bug886164_6.html^headers^ b/dom/security/test/csp/file_bug886164_6.html^headers^ similarity index 100% rename from dom/base/test/csp/file_bug886164_6.html^headers^ rename to dom/security/test/csp/file_bug886164_6.html^headers^ diff --git a/dom/base/test/csp/file_CSP_bug888172.html b/dom/security/test/csp/file_bug888172.html similarity index 100% rename from dom/base/test/csp/file_CSP_bug888172.html rename to dom/security/test/csp/file_bug888172.html diff --git a/dom/base/test/csp/file_CSP_bug888172.sjs b/dom/security/test/csp/file_bug888172.sjs similarity index 94% rename from dom/base/test/csp/file_CSP_bug888172.sjs rename to dom/security/test/csp/file_bug888172.sjs index 7427f415b7..03309610f7 100644 --- a/dom/base/test/csp/file_CSP_bug888172.sjs +++ b/dom/security/test/csp/file_bug888172.sjs @@ -39,5 +39,5 @@ function handleRequest(request, response) // Send HTML to test allowed/blocked behaviors response.setHeader("Content-Type", "text/html", false); - response.write(loadHTMLFromFile("tests/dom/base/test/csp/file_CSP_bug888172.html")); + response.write(loadHTMLFromFile("tests/dom/security/test/csp/file_bug888172.html")); } diff --git a/dom/base/test/csp/file_CSP_bug909029_none.html b/dom/security/test/csp/file_bug909029_none.html similarity index 100% rename from dom/base/test/csp/file_CSP_bug909029_none.html rename to dom/security/test/csp/file_bug909029_none.html diff --git a/dom/base/test/csp/file_CSP_bug909029_none.html^headers^ b/dom/security/test/csp/file_bug909029_none.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_bug909029_none.html^headers^ rename to dom/security/test/csp/file_bug909029_none.html^headers^ diff --git a/dom/base/test/csp/file_CSP_bug909029_star.html b/dom/security/test/csp/file_bug909029_star.html similarity index 100% rename from dom/base/test/csp/file_CSP_bug909029_star.html rename to dom/security/test/csp/file_bug909029_star.html diff --git a/dom/base/test/csp/file_CSP_bug909029_star.html^headers^ b/dom/security/test/csp/file_bug909029_star.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_bug909029_star.html^headers^ rename to dom/security/test/csp/file_bug909029_star.html^headers^ diff --git a/dom/base/test/csp/file_CSP_bug910139.sjs b/dom/security/test/csp/file_bug910139.sjs similarity index 89% rename from dom/base/test/csp/file_CSP_bug910139.sjs rename to dom/security/test/csp/file_bug910139.sjs index 6ca39ba106..172cc09c9b 100644 --- a/dom/base/test/csp/file_CSP_bug910139.sjs +++ b/dom/security/test/csp/file_bug910139.sjs @@ -1,4 +1,4 @@ -// Server side js file for bug 910139, see file test_CSP_bug910139.html for details. +// Server side js file for bug 910139, see file test_bug910139.html for details. Components.utils.import("resource://gre/modules/NetUtil.jsm"); @@ -48,5 +48,5 @@ function handleRequest(request, response) response.setHeader("Content-Security-Policy", getPolicy(), false); // return the requested XML file. - response.write(loadResponseFromFile("tests/dom/base/test/csp/file_CSP_bug910139.xml")); + response.write(loadResponseFromFile("tests/dom/security/test/csp/file_bug910139.xml")); } diff --git a/dom/base/test/csp/file_CSP_bug910139.xml b/dom/security/test/csp/file_bug910139.xml similarity index 89% rename from dom/base/test/csp/file_CSP_bug910139.xml rename to dom/security/test/csp/file_bug910139.xml index b00e064d5f..29feba9418 100644 --- a/dom/base/test/csp/file_CSP_bug910139.xml +++ b/dom/security/test/csp/file_bug910139.xml @@ -1,5 +1,5 @@ - + Empire Burlesque diff --git a/dom/base/test/csp/file_CSP_bug910139.xsl b/dom/security/test/csp/file_bug910139.xsl similarity index 100% rename from dom/base/test/csp/file_CSP_bug910139.xsl rename to dom/security/test/csp/file_bug910139.xsl diff --git a/dom/base/test/csp/file_CSP_bug941404.html b/dom/security/test/csp/file_bug941404.html similarity index 64% rename from dom/base/test/csp/file_CSP_bug941404.html rename to dom/security/test/csp/file_bug941404.html index 5f11f233fc..3a2e636e0b 100644 --- a/dom/base/test/csp/file_CSP_bug941404.html +++ b/dom/security/test/csp/file_bug941404.html @@ -3,7 +3,7 @@ - + diff --git a/dom/base/test/csp/file_CSP_bug941404_xhr.html b/dom/security/test/csp/file_bug941404_xhr.html similarity index 100% rename from dom/base/test/csp/file_CSP_bug941404_xhr.html rename to dom/security/test/csp/file_bug941404_xhr.html diff --git a/dom/base/test/csp/file_CSP_bug941404_xhr.html^headers^ b/dom/security/test/csp/file_bug941404_xhr.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_bug941404_xhr.html^headers^ rename to dom/security/test/csp/file_bug941404_xhr.html^headers^ diff --git a/dom/security/test/csp/file_connect-src-fetch.html b/dom/security/test/csp/file_connect-src-fetch.html new file mode 100644 index 0000000000..ff9b2f740b --- /dev/null +++ b/dom/security/test/csp/file_connect-src-fetch.html @@ -0,0 +1,16 @@ + + + + Bug 1139667 - Test mapping of fetch() to connect-src + + + + + diff --git a/dom/base/test/csp/file_connect-src.html b/dom/security/test/csp/file_connect-src.html similarity index 74% rename from dom/base/test/csp/file_connect-src.html rename to dom/security/test/csp/file_connect-src.html index 330a695557..17a940a0e0 100644 --- a/dom/base/test/csp/file_connect-src.html +++ b/dom/security/test/csp/file_connect-src.html @@ -7,11 +7,11 @@ + src="file_evalscript_main.js"> diff --git a/dom/base/test/csp/file_CSP_evalscript_main.html^headers^ b/dom/security/test/csp/file_evalscript_main.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_evalscript_main.html^headers^ rename to dom/security/test/csp/file_evalscript_main.html^headers^ diff --git a/dom/base/test/csp/file_CSP_evalscript_main.js b/dom/security/test/csp/file_evalscript_main.js similarity index 100% rename from dom/base/test/csp/file_CSP_evalscript_main.js rename to dom/security/test/csp/file_evalscript_main.js diff --git a/dom/base/test/csp/file_CSP_evalscript_main_allowed.html b/dom/security/test/csp/file_evalscript_main_allowed.html similarity index 69% rename from dom/base/test/csp/file_CSP_evalscript_main_allowed.html rename to dom/security/test/csp/file_evalscript_main_allowed.html index 8d18b08166..274972d9bd 100644 --- a/dom/base/test/csp/file_CSP_evalscript_main_allowed.html +++ b/dom/security/test/csp/file_evalscript_main_allowed.html @@ -2,7 +2,7 @@ CSP eval script tests + src="file_evalscript_main_allowed.js"> diff --git a/dom/base/test/csp/file_CSP_evalscript_main_allowed.html^headers^ b/dom/security/test/csp/file_evalscript_main_allowed.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_evalscript_main_allowed.html^headers^ rename to dom/security/test/csp/file_evalscript_main_allowed.html^headers^ diff --git a/dom/base/test/csp/file_CSP_evalscript_main_allowed.js b/dom/security/test/csp/file_evalscript_main_allowed.js similarity index 100% rename from dom/base/test/csp/file_CSP_evalscript_main_allowed.js rename to dom/security/test/csp/file_evalscript_main_allowed.js diff --git a/dom/base/test/csp/file_form-action.html b/dom/security/test/csp/file_form-action.html similarity index 100% rename from dom/base/test/csp/file_form-action.html rename to dom/security/test/csp/file_form-action.html diff --git a/dom/base/test/csp/file_CSP_frameancestors.sjs b/dom/security/test/csp/file_frameancestors.sjs similarity index 89% rename from dom/base/test/csp/file_CSP_frameancestors.sjs rename to dom/security/test/csp/file_frameancestors.sjs index 37c296a659..d0a77893f7 100644 --- a/dom/base/test/csp/file_CSP_frameancestors.sjs +++ b/dom/security/test/csp/file_frameancestors.sjs @@ -30,9 +30,9 @@ function handleRequest(request, response) response.setHeader("Content-Type", "text/html", false); response.write(''); if (query['double']) - response.write(''); + response.write(''); else - response.write(''); + response.write(''); response.write(''); response.write(unescape(query['internalframe'])); response.write(''); diff --git a/dom/base/test/csp/file_CSP_frameancestors_main.html b/dom/security/test/csp/file_frameancestors_main.html similarity index 95% rename from dom/base/test/csp/file_CSP_frameancestors_main.html rename to dom/security/test/csp/file_frameancestors_main.html index d7f835a187..97f9cb9ac5 100644 --- a/dom/base/test/csp/file_CSP_frameancestors_main.html +++ b/dom/security/test/csp/file_frameancestors_main.html @@ -3,7 +3,7 @@ CSP frame ancestors tests - + diff --git a/dom/base/test/csp/file_CSP_frameancestors_main.js b/dom/security/test/csp/file_frameancestors_main.js similarity index 93% rename from dom/base/test/csp/file_CSP_frameancestors_main.js rename to dom/security/test/csp/file_frameancestors_main.js index a5b17027c6..caffc72575 100644 --- a/dom/base/test/csp/file_CSP_frameancestors_main.js +++ b/dom/security/test/csp/file_frameancestors_main.js @@ -4,9 +4,9 @@ function setupFrames() { var $ = function(v) { return document.getElementById(v); } var base = { - self: '/tests/dom/base/test/csp/file_CSP_frameancestors.sjs', - a: 'http://mochi.test:8888/tests/dom/base/test/csp/file_CSP_frameancestors.sjs', - b: 'http://example.com/tests/dom/base/test/csp/file_CSP_frameancestors.sjs' + self: '/tests/dom/security/test/csp/file_frameancestors.sjs', + a: 'http://mochi.test:8888/tests/dom/security/test/csp/file_frameancestors.sjs', + b: 'http://example.com/tests/dom/security/test/csp/file_frameancestors.sjs' }; var host = { a: 'http://mochi.test:8888', b: 'http://example.com:80' }; diff --git a/dom/base/test/csp/file_hash_source.html b/dom/security/test/csp/file_hash_source.html similarity index 100% rename from dom/base/test/csp/file_hash_source.html rename to dom/security/test/csp/file_hash_source.html diff --git a/dom/base/test/csp/file_hash_source.html^headers^ b/dom/security/test/csp/file_hash_source.html^headers^ similarity index 100% rename from dom/base/test/csp/file_hash_source.html^headers^ rename to dom/security/test/csp/file_hash_source.html^headers^ diff --git a/dom/security/test/csp/file_ignore_unsafe_inline.html b/dom/security/test/csp/file_ignore_unsafe_inline.html new file mode 100644 index 0000000000..b0d44b5709 --- /dev/null +++ b/dom/security/test/csp/file_ignore_unsafe_inline.html @@ -0,0 +1,26 @@ + + + +Bug 1004703 - ignore 'unsafe-inline' if nonce- or hash-source specified + + +
a
+ + + + + + + + + + + + + diff --git a/dom/base/test/csp/file_CSP_inlinescript_main.html b/dom/security/test/csp/file_inlinescript_main.html similarity index 100% rename from dom/base/test/csp/file_CSP_inlinescript_main.html rename to dom/security/test/csp/file_inlinescript_main.html diff --git a/dom/base/test/csp/file_CSP_inlinescript_main.html^headers^ b/dom/security/test/csp/file_inlinescript_main.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_inlinescript_main.html^headers^ rename to dom/security/test/csp/file_inlinescript_main.html^headers^ diff --git a/dom/base/test/csp/file_CSP_inlinescript_main_allowed.html b/dom/security/test/csp/file_inlinescript_main_allowed.html similarity index 100% rename from dom/base/test/csp/file_CSP_inlinescript_main_allowed.html rename to dom/security/test/csp/file_inlinescript_main_allowed.html diff --git a/dom/base/test/csp/file_CSP_inlinescript_main_allowed.html^headers^ b/dom/security/test/csp/file_inlinescript_main_allowed.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_inlinescript_main_allowed.html^headers^ rename to dom/security/test/csp/file_inlinescript_main_allowed.html^headers^ diff --git a/dom/base/test/csp/file_CSP_inlinestyle_main.html b/dom/security/test/csp/file_inlinestyle_main.html similarity index 100% rename from dom/base/test/csp/file_CSP_inlinestyle_main.html rename to dom/security/test/csp/file_inlinestyle_main.html diff --git a/dom/base/test/csp/file_CSP_inlinestyle_main.html^headers^ b/dom/security/test/csp/file_inlinestyle_main.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_inlinestyle_main.html^headers^ rename to dom/security/test/csp/file_inlinestyle_main.html^headers^ diff --git a/dom/base/test/csp/file_CSP_inlinestyle_main_allowed.html b/dom/security/test/csp/file_inlinestyle_main_allowed.html similarity index 100% rename from dom/base/test/csp/file_CSP_inlinestyle_main_allowed.html rename to dom/security/test/csp/file_inlinestyle_main_allowed.html diff --git a/dom/base/test/csp/file_CSP_inlinestyle_main_allowed.html^headers^ b/dom/security/test/csp/file_inlinestyle_main_allowed.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_inlinestyle_main_allowed.html^headers^ rename to dom/security/test/csp/file_inlinestyle_main_allowed.html^headers^ diff --git a/dom/base/test/csp/file_csp_invalid_source_expression.html b/dom/security/test/csp/file_invalid_source_expression.html similarity index 50% rename from dom/base/test/csp/file_csp_invalid_source_expression.html rename to dom/security/test/csp/file_invalid_source_expression.html index 155e6d0f8b..83bb0ec0ca 100644 --- a/dom/base/test/csp/file_csp_invalid_source_expression.html +++ b/dom/security/test/csp/file_invalid_source_expression.html @@ -5,7 +5,7 @@
blocked
- - + + diff --git a/dom/base/test/csp/file_leading_wildcard.html b/dom/security/test/csp/file_leading_wildcard.html similarity index 54% rename from dom/base/test/csp/file_leading_wildcard.html rename to dom/security/test/csp/file_leading_wildcard.html index 4270adf78f..ea5e993447 100644 --- a/dom/base/test/csp/file_leading_wildcard.html +++ b/dom/security/test/csp/file_leading_wildcard.html @@ -5,7 +5,7 @@ - - + + diff --git a/dom/base/test/csp/file_CSP_main.html b/dom/security/test/csp/file_main.html similarity index 60% rename from dom/base/test/csp/file_CSP_main.html rename to dom/security/test/csp/file_main.html index 7bd4ae7f82..ddc8382617 100644 --- a/dom/base/test/csp/file_CSP_main.html +++ b/dom/security/test/csp/file_main.html @@ -1,7 +1,7 @@ + href='http://example.org/tests/dom/security/test/csp/file_CSP.sjs?testid=style_bad&type=text/css' /> @@ -14,7 +14,7 @@ } @font-face { font-family: "arbitrary_bad"; - src: url('http://example.org/tests/dom/base/test/csp/file_CSP.sjs?testid=font_bad&type=application/octet-stream'); + src: url('http://example.org/tests/dom/security/test/csp/file_CSP.sjs?testid=font_bad&type=application/octet-stream'); } .div_arbitrary_good { font-family: "arbitrary_good"; } @@ -23,13 +23,13 @@ - - - - + + + + - - + + @@ -46,7 +46,7 @@ - +
arbitrary good
diff --git a/dom/base/test/csp/file_CSP_main.html^headers^ b/dom/security/test/csp/file_main.html^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_main.html^headers^ rename to dom/security/test/csp/file_main.html^headers^ diff --git a/dom/base/test/csp/file_CSP_main.js b/dom/security/test/csp/file_main.js similarity index 59% rename from dom/base/test/csp/file_CSP_main.js rename to dom/security/test/csp/file_main.js index 1da3ddab21..864a5d230b 100644 --- a/dom/base/test/csp/file_CSP_main.js +++ b/dom/security/test/csp/file_main.js @@ -3,14 +3,14 @@ try { var xhr_good = new XMLHttpRequest(); - var xhr_good_uri ="http://mochi.test:8888/tests/dom/base/test/csp/file_CSP.sjs?testid=xhr_good"; + var xhr_good_uri ="http://mochi.test:8888/tests/dom/security/test/csp/file_CSP.sjs?testid=xhr_good"; xhr_good.open("GET", xhr_good_uri, true); xhr_good.send(null); } catch(e) {} try { var xhr_bad = new XMLHttpRequest(); - var xhr_bad_uri ="http://example.com/tests/dom/base/test/csp/file_CSP.sjs?testid=xhr_bad"; + var xhr_bad_uri ="http://example.com/tests/dom/security/test/csp/file_CSP.sjs?testid=xhr_bad"; xhr_bad.open("GET", xhr_bad_uri, true); xhr_bad.send(null); } catch(e) {} diff --git a/dom/base/test/csp/file_multi_policy_injection_bypass.html b/dom/security/test/csp/file_multi_policy_injection_bypass.html similarity index 61% rename from dom/base/test/csp/file_multi_policy_injection_bypass.html rename to dom/security/test/csp/file_multi_policy_injection_bypass.html index 4932387c74..a3cb415a9e 100644 --- a/dom/base/test/csp/file_multi_policy_injection_bypass.html +++ b/dom/security/test/csp/file_multi_policy_injection_bypass.html @@ -4,8 +4,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=717511 --> - - + + diff --git a/dom/base/test/csp/file_multi_policy_injection_bypass.html^headers^ b/dom/security/test/csp/file_multi_policy_injection_bypass.html^headers^ similarity index 100% rename from dom/base/test/csp/file_multi_policy_injection_bypass.html^headers^ rename to dom/security/test/csp/file_multi_policy_injection_bypass.html^headers^ diff --git a/dom/base/test/csp/file_multi_policy_injection_bypass_2.html b/dom/security/test/csp/file_multi_policy_injection_bypass_2.html similarity index 61% rename from dom/base/test/csp/file_multi_policy_injection_bypass_2.html rename to dom/security/test/csp/file_multi_policy_injection_bypass_2.html index f3696bb859..3fa6c7ab91 100644 --- a/dom/base/test/csp/file_multi_policy_injection_bypass_2.html +++ b/dom/security/test/csp/file_multi_policy_injection_bypass_2.html @@ -4,8 +4,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=717511 --> - - + + diff --git a/dom/base/test/csp/file_multi_policy_injection_bypass_2.html^headers^ b/dom/security/test/csp/file_multi_policy_injection_bypass_2.html^headers^ similarity index 100% rename from dom/base/test/csp/file_multi_policy_injection_bypass_2.html^headers^ rename to dom/security/test/csp/file_multi_policy_injection_bypass_2.html^headers^ diff --git a/dom/base/test/csp/file_nonce_source.html b/dom/security/test/csp/file_nonce_source.html similarity index 85% rename from dom/base/test/csp/file_nonce_source.html rename to dom/security/test/csp/file_nonce_source.html index 7892ad9b22..bf14ffe641 100644 --- a/dom/base/test/csp/file_nonce_source.html +++ b/dom/security/test/csp/file_nonce_source.html @@ -29,11 +29,11 @@ - - - - - + + + + + diff --git a/dom/base/test/csp/file_nonce_source.html^headers^ b/dom/security/test/csp/file_nonce_source.html^headers^ similarity index 100% rename from dom/base/test/csp/file_nonce_source.html^headers^ rename to dom/security/test/csp/file_nonce_source.html^headers^ diff --git a/dom/base/test/csp/file_null_baseuri.html b/dom/security/test/csp/file_null_baseuri.html similarity index 100% rename from dom/base/test/csp/file_null_baseuri.html rename to dom/security/test/csp/file_null_baseuri.html diff --git a/dom/base/test/csp/file_csp_path_matching.html b/dom/security/test/csp/file_path_matching.html similarity index 63% rename from dom/base/test/csp/file_csp_path_matching.html rename to dom/security/test/csp/file_path_matching.html index 4126ed58a0..662fbfb8af 100644 --- a/dom/base/test/csp/file_csp_path_matching.html +++ b/dom/security/test/csp/file_path_matching.html @@ -5,6 +5,6 @@
blocked
- + diff --git a/dom/base/test/csp/file_csp_path_matching.js b/dom/security/test/csp/file_path_matching.js similarity index 100% rename from dom/base/test/csp/file_csp_path_matching.js rename to dom/security/test/csp/file_path_matching.js diff --git a/dom/base/test/csp/file_csp_path_matching_incl_query.html b/dom/security/test/csp/file_path_matching_incl_query.html similarity index 64% rename from dom/base/test/csp/file_csp_path_matching_incl_query.html rename to dom/security/test/csp/file_path_matching_incl_query.html index 7647ebf2f0..50af2b1437 100644 --- a/dom/base/test/csp/file_csp_path_matching_incl_query.html +++ b/dom/security/test/csp/file_path_matching_incl_query.html @@ -5,6 +5,6 @@
blocked
- + diff --git a/dom/base/test/csp/file_csp_path_matching_redirect.html b/dom/security/test/csp/file_path_matching_redirect.html similarity index 61% rename from dom/base/test/csp/file_csp_path_matching_redirect.html rename to dom/security/test/csp/file_path_matching_redirect.html index c1716b4503..a16cc90ec6 100644 --- a/dom/base/test/csp/file_csp_path_matching_redirect.html +++ b/dom/security/test/csp/file_path_matching_redirect.html @@ -5,6 +5,6 @@
blocked
- + diff --git a/dom/base/test/csp/file_csp_path_matching_redirect_server.sjs b/dom/security/test/csp/file_path_matching_redirect_server.sjs similarity index 78% rename from dom/base/test/csp/file_csp_path_matching_redirect_server.sjs rename to dom/security/test/csp/file_path_matching_redirect_server.sjs index 41943cbc30..49a3160f4e 100644 --- a/dom/base/test/csp/file_csp_path_matching_redirect_server.sjs +++ b/dom/security/test/csp/file_path_matching_redirect_server.sjs @@ -5,7 +5,7 @@ function handleRequest(request, response) { - var newLocation = "http://test1.example.com/tests/dom/base/test/csp/file_csp_path_matching.js"; + var newLocation = "http://test1.example.com/tests/dom/security/test/csp/file_path_matching.js"; response.setStatusLine("1.1", 302, "Found"); response.setHeader("Cache-Control", "no-cache", false); diff --git a/dom/base/test/csp/file_policyuri_regression_from_multipolicy.html b/dom/security/test/csp/file_policyuri_regression_from_multipolicy.html similarity index 100% rename from dom/base/test/csp/file_policyuri_regression_from_multipolicy.html rename to dom/security/test/csp/file_policyuri_regression_from_multipolicy.html diff --git a/dom/security/test/csp/file_policyuri_regression_from_multipolicy.html^headers^ b/dom/security/test/csp/file_policyuri_regression_from_multipolicy.html^headers^ new file mode 100644 index 0000000000..c4ff8ea9fd --- /dev/null +++ b/dom/security/test/csp/file_policyuri_regression_from_multipolicy.html^headers^ @@ -0,0 +1 @@ +content-security-policy-report-only: policy-uri /tests/dom/security/test/csp/file_policyuri_regression_from_multipolicy_policy diff --git a/dom/base/test/csp/file_policyuri_regression_from_multipolicy_policy b/dom/security/test/csp/file_policyuri_regression_from_multipolicy_policy similarity index 100% rename from dom/base/test/csp/file_policyuri_regression_from_multipolicy_policy rename to dom/security/test/csp/file_policyuri_regression_from_multipolicy_policy diff --git a/dom/base/test/csp/file_redirect_content.sjs b/dom/security/test/csp/file_redirect_content.sjs similarity index 95% rename from dom/base/test/csp/file_redirect_content.sjs rename to dom/security/test/csp/file_redirect_content.sjs index d0e31412f7..080f179cd2 100644 --- a/dom/base/test/csp/file_redirect_content.sjs +++ b/dom/security/test/csp/file_redirect_content.sjs @@ -23,7 +23,7 @@ function handleRequest(request, response) { return; } - var csp = "default-src \'self\';report-uri http://mochi.test:8888/tests/dom/base/test/csp/file_redirect_report.sjs?" + redirect; + var csp = "default-src \'self\';report-uri http://mochi.test:8888/tests/dom/security/test/csp/file_redirect_report.sjs?" + redirect; response.setHeader("Content-Security-Policy", csp, false); diff --git a/dom/base/test/csp/file_redirect_report.sjs b/dom/security/test/csp/file_redirect_report.sjs similarity index 100% rename from dom/base/test/csp/file_redirect_report.sjs rename to dom/security/test/csp/file_redirect_report.sjs diff --git a/dom/base/test/csp/file_csp_redirects_main.html b/dom/security/test/csp/file_redirects_main.html similarity index 95% rename from dom/base/test/csp/file_csp_redirects_main.html rename to dom/security/test/csp/file_redirects_main.html index 133da6f05d..651f44d384 100644 --- a/dom/base/test/csp/file_csp_redirects_main.html +++ b/dom/security/test/csp/file_redirects_main.html @@ -9,7 +9,7 @@ - - diff --git a/dom/base/test/csp/file_csp_report.html b/dom/security/test/csp/file_report.html similarity index 100% rename from dom/base/test/csp/file_csp_report.html rename to dom/security/test/csp/file_report.html diff --git a/dom/base/test/csp/file_report_uri_missing_in_report_only_header.html b/dom/security/test/csp/file_report_uri_missing_in_report_only_header.html similarity index 100% rename from dom/base/test/csp/file_report_uri_missing_in_report_only_header.html rename to dom/security/test/csp/file_report_uri_missing_in_report_only_header.html diff --git a/dom/base/test/csp/file_report_uri_missing_in_report_only_header.html^headers^ b/dom/security/test/csp/file_report_uri_missing_in_report_only_header.html^headers^ similarity index 100% rename from dom/base/test/csp/file_report_uri_missing_in_report_only_header.html^headers^ rename to dom/security/test/csp/file_report_uri_missing_in_report_only_header.html^headers^ diff --git a/dom/security/test/csp/file_scheme_relative_sources.js b/dom/security/test/csp/file_scheme_relative_sources.js new file mode 100644 index 0000000000..09286d42e9 --- /dev/null +++ b/dom/security/test/csp/file_scheme_relative_sources.js @@ -0,0 +1 @@ +document.getElementById("testdiv").innerHTML = "allowed"; diff --git a/dom/security/test/csp/file_scheme_relative_sources.sjs b/dom/security/test/csp/file_scheme_relative_sources.sjs new file mode 100644 index 0000000000..8c4d62ca5d --- /dev/null +++ b/dom/security/test/csp/file_scheme_relative_sources.sjs @@ -0,0 +1,42 @@ +/** + * Custom *.sjs specifically for the needs of + * Bug 921493 - CSP: test whitelisting of scheme-relative sources + */ + +function handleRequest(request, response) +{ + Components.utils.importGlobalProperties(["URLSearchParams"]); + let query = new URLSearchParams(request.queryString); + + let scheme = query.get("scheme"); + let policy = query.get("policy"); + + let linkUrl = scheme + + "://example.com/tests/dom/security/test/csp/file_scheme_relative_sources.js"; + + let html = "" + + "" + + "" + + "test schemeless sources within CSP" + + "" + + " " + + "
blocked
" + + // try to load a scheme relative script + "" + + // have an inline script that reports back to the parent whether + // the script got loaded or not from within the sandboxed iframe. + "" + + "" + + ""; + + response.setHeader("Cache-Control", "no-cache", false); + response.setHeader("Content-Type", "text/html", false); + response.setHeader("Content-Security-Policy", policy, false); + + response.write(html); +} diff --git a/dom/base/test/csp/file_self_none_as_hostname_confusion.html b/dom/security/test/csp/file_self_none_as_hostname_confusion.html similarity index 100% rename from dom/base/test/csp/file_self_none_as_hostname_confusion.html rename to dom/security/test/csp/file_self_none_as_hostname_confusion.html diff --git a/dom/base/test/csp/file_self_none_as_hostname_confusion.html^headers^ b/dom/security/test/csp/file_self_none_as_hostname_confusion.html^headers^ similarity index 100% rename from dom/base/test/csp/file_self_none_as_hostname_confusion.html^headers^ rename to dom/security/test/csp/file_self_none_as_hostname_confusion.html^headers^ diff --git a/dom/base/test/csp/file_subframe_run_js_if_allowed.html b/dom/security/test/csp/file_subframe_run_js_if_allowed.html similarity index 100% rename from dom/base/test/csp/file_subframe_run_js_if_allowed.html rename to dom/security/test/csp/file_subframe_run_js_if_allowed.html diff --git a/dom/base/test/csp/file_subframe_run_js_if_allowed.html^headers^ b/dom/security/test/csp/file_subframe_run_js_if_allowed.html^headers^ similarity index 100% rename from dom/base/test/csp/file_subframe_run_js_if_allowed.html^headers^ rename to dom/security/test/csp/file_subframe_run_js_if_allowed.html^headers^ diff --git a/dom/base/test/csp/file_csp_testserver.sjs b/dom/security/test/csp/file_testserver.sjs similarity index 100% rename from dom/base/test/csp/file_csp_testserver.sjs rename to dom/security/test/csp/file_testserver.sjs diff --git a/dom/security/test/csp/file_web_manifest.html b/dom/security/test/csp/file_web_manifest.html new file mode 100644 index 0000000000..0f6a67460e --- /dev/null +++ b/dom/security/test/csp/file_web_manifest.html @@ -0,0 +1,6 @@ + + + + + +

Support Page for Web Manifest Tests

\ No newline at end of file diff --git a/dom/base/test/csp/file_CSP_web_manifest.json b/dom/security/test/csp/file_web_manifest.json similarity index 100% rename from dom/base/test/csp/file_CSP_web_manifest.json rename to dom/security/test/csp/file_web_manifest.json diff --git a/dom/base/test/csp/file_CSP_web_manifest.json^headers^ b/dom/security/test/csp/file_web_manifest.json^headers^ similarity index 100% rename from dom/base/test/csp/file_CSP_web_manifest.json^headers^ rename to dom/security/test/csp/file_web_manifest.json^headers^ diff --git a/dom/security/test/csp/file_web_manifest_https.html b/dom/security/test/csp/file_web_manifest_https.html new file mode 100644 index 0000000000..b0ff9ef853 --- /dev/null +++ b/dom/security/test/csp/file_web_manifest_https.html @@ -0,0 +1,4 @@ + + + +

Support Page for Web Manifest Tests

\ No newline at end of file diff --git a/dom/base/test/csp/file_CSP_web_manifest_https.json b/dom/security/test/csp/file_web_manifest_https.json similarity index 100% rename from dom/base/test/csp/file_CSP_web_manifest_https.json rename to dom/security/test/csp/file_web_manifest_https.json diff --git a/dom/base/test/csp/file_CSP_web_manifest_mixed_content.html b/dom/security/test/csp/file_web_manifest_mixed_content.html similarity index 54% rename from dom/base/test/csp/file_CSP_web_manifest_mixed_content.html rename to dom/security/test/csp/file_web_manifest_mixed_content.html index 201bfc4963..55f17c0f92 100644 --- a/dom/base/test/csp/file_CSP_web_manifest_mixed_content.html +++ b/dom/security/test/csp/file_web_manifest_mixed_content.html @@ -3,7 +3,7 @@ + href="http://example.org/tests/dom/security/test/csp/file_testserver.sjs?file=/test/dom/security/test/csp/file_web_manifest.json&cors=*">

Support Page for Web Manifest Tests

Used to try to load a resource over an insecure connection to trigger mixed content blocking.

\ No newline at end of file diff --git a/dom/base/test/csp/file_CSP_web_manifest_remote.html b/dom/security/test/csp/file_web_manifest_remote.html similarity index 60% rename from dom/base/test/csp/file_CSP_web_manifest_remote.html rename to dom/security/test/csp/file_web_manifest_remote.html index 4a3397874b..7ecf8eec43 100644 --- a/dom/base/test/csp/file_CSP_web_manifest_remote.html +++ b/dom/security/test/csp/file_web_manifest_remote.html @@ -2,7 +2,7 @@ + href="//mochi.test:8888/tests/dom/security/test/csp/file_testserver.sjs?file=/tests/dom/security/test/csp/file_web_manifest.json&cors=*">

Support Page for Web Manifest Tests

Loads a manifest from mochi.test:8888 with CORS set to "*".

\ No newline at end of file diff --git a/dom/base/test/csp/file_worker_redirect.html b/dom/security/test/csp/file_worker_redirect.html similarity index 100% rename from dom/base/test/csp/file_worker_redirect.html rename to dom/security/test/csp/file_worker_redirect.html diff --git a/dom/base/test/csp/file_worker_redirect.sjs b/dom/security/test/csp/file_worker_redirect.sjs similarity index 91% rename from dom/base/test/csp/file_worker_redirect.sjs rename to dom/security/test/csp/file_worker_redirect.sjs index 5245313678..6c4acd6e7a 100644 --- a/dom/base/test/csp/file_worker_redirect.sjs +++ b/dom/security/test/csp/file_worker_redirect.sjs @@ -24,7 +24,7 @@ function handleRequest(request, response) if (query === "stage_2_redirect_imported_script") { var newLocation = - "http://test1.example.com/tests/dom/base/test/csp/file_worker_redirect.sjs?stage_3_target_script"; + "http://test1.example.com/tests/dom/security/test/csp/file_worker_redirect.sjs?stage_3_target_script"; response.setStatusLine("1.1", 302, "Found"); response.setHeader("Location", newLocation, false); return; diff --git a/dom/base/test/csp/mochitest.ini b/dom/security/test/csp/mochitest.ini similarity index 51% rename from dom/base/test/csp/mochitest.ini rename to dom/security/test/csp/mochitest.ini index af21707bbf..efd3cd9197 100644 --- a/dom/base/test/csp/mochitest.ini +++ b/dom/security/test/csp/mochitest.ini @@ -1,53 +1,55 @@ [DEFAULT] support-files = file_base-uri.html + file_blob_data_schemes.html file_connect-src.html + file_connect-src-fetch.html file_CSP.css file_CSP.sjs - file_csp_allow_https_schemes.html - file_CSP_bug663567.xsl - file_CSP_bug663567_allows.xml - file_CSP_bug663567_allows.xml^headers^ - file_CSP_bug663567_blocks.xml - file_CSP_bug663567_blocks.xml^headers^ - file_CSP_bug802872.html - file_CSP_bug802872.html^headers^ - file_CSP_bug802872.js - file_CSP_bug802872.sjs - file_CSP_bug885433_allows.html - file_CSP_bug885433_allows.html^headers^ - file_CSP_bug885433_blocks.html - file_CSP_bug885433_blocks.html^headers^ - file_CSP_bug888172.html - file_CSP_bug888172.sjs - file_CSP_evalscript_main.js - file_CSP_evalscript_main_allowed.js - file_CSP_evalscript_main.html - file_CSP_evalscript_main.html^headers^ - file_CSP_evalscript_main_allowed.html - file_CSP_evalscript_main_allowed.html^headers^ - file_CSP_frameancestors_main.html - file_CSP_frameancestors_main.js - file_CSP_frameancestors.sjs - file_CSP_inlinescript_main.html - file_CSP_inlinescript_main.html^headers^ - file_CSP_inlinescript_main_allowed.html - file_CSP_inlinescript_main_allowed.html^headers^ - file_CSP_inlinestyle_main.html - file_CSP_inlinestyle_main.html^headers^ - file_CSP_inlinestyle_main_allowed.html - file_CSP_inlinestyle_main_allowed.html^headers^ - file_csp_invalid_source_expression.html - file_CSP_main.html - file_CSP_main.html^headers^ - file_CSP_main.js - file_CSP_web_manifest.html - file_CSP_web_manifest_remote.html - file_CSP_web_manifest_https.html - file_CSP_web_manifest.json - file_CSP_web_manifest.json^headers^ - file_CSP_web_manifest_https.json - file_CSP_web_manifest_mixed_content.html + file_allow_https_schemes.html + file_bug663567.xsl + file_bug663567_allows.xml + file_bug663567_allows.xml^headers^ + file_bug663567_blocks.xml + file_bug663567_blocks.xml^headers^ + file_bug802872.html + file_bug802872.html^headers^ + file_bug802872.js + file_bug802872.sjs + file_bug885433_allows.html + file_bug885433_allows.html^headers^ + file_bug885433_blocks.html + file_bug885433_blocks.html^headers^ + file_bug888172.html + file_bug888172.sjs + file_evalscript_main.js + file_evalscript_main_allowed.js + file_evalscript_main.html + file_evalscript_main.html^headers^ + file_evalscript_main_allowed.html + file_evalscript_main_allowed.html^headers^ + file_frameancestors_main.html + file_frameancestors_main.js + file_frameancestors.sjs + file_inlinescript_main.html + file_inlinescript_main.html^headers^ + file_inlinescript_main_allowed.html + file_inlinescript_main_allowed.html^headers^ + file_inlinestyle_main.html + file_inlinestyle_main.html^headers^ + file_inlinestyle_main_allowed.html + file_inlinestyle_main_allowed.html^headers^ + file_invalid_source_expression.html + file_main.html + file_main.html^headers^ + file_main.js + file_web_manifest.html + file_web_manifest_remote.html + file_web_manifest_https.html + file_web_manifest.json + file_web_manifest.json^headers^ + file_web_manifest_https.json + file_web_manifest_mixed_content.html file_bug836922_npolicies.html file_bug836922_npolicies.html^headers^ file_bug836922_npolicies_ro_violation.sjs @@ -64,41 +66,44 @@ support-files = file_bug886164_5.html^headers^ file_bug886164_6.html file_bug886164_6.html^headers^ - file_csp_bug768029.html - file_csp_bug768029.sjs - file_csp_bug773891.html - file_csp_bug773891.sjs - file_csp_redirects_main.html - file_csp_redirects_page.sjs - file_csp_redirects_resource.sjs - file_CSP_bug910139.sjs - file_CSP_bug910139.xml - file_CSP_bug910139.xsl - file_CSP_bug909029_star.html - file_CSP_bug909029_star.html^headers^ - file_CSP_bug909029_none.html - file_CSP_bug909029_none.html^headers^ + file_bug768029.html + file_bug768029.sjs + file_bug773891.html + file_bug773891.sjs + file_redirects_main.html + file_redirects_page.sjs + file_redirects_resource.sjs + file_bug910139.sjs + file_bug910139.xml + file_bug910139.xsl + file_bug909029_star.html + file_bug909029_star.html^headers^ + file_bug909029_none.html + file_bug909029_none.html^headers^ file_policyuri_regression_from_multipolicy.html file_policyuri_regression_from_multipolicy.html^headers^ file_policyuri_regression_from_multipolicy_policy file_nonce_source.html file_nonce_source.html^headers^ - file_CSP_bug941404.html - file_CSP_bug941404_xhr.html - file_CSP_bug941404_xhr.html^headers^ + file_bug941404.html + file_bug941404_xhr.html + file_bug941404_xhr.html^headers^ file_hash_source.html file_hash_source.html^headers^ + file_scheme_relative_sources.js + file_scheme_relative_sources.sjs + file_ignore_unsafe_inline.html file_self_none_as_hostname_confusion.html file_self_none_as_hostname_confusion.html^headers^ - file_csp_path_matching.html - file_csp_path_matching_incl_query.html - file_csp_path_matching.js - file_csp_path_matching_redirect.html - file_csp_path_matching_redirect_server.sjs - file_csp_testserver.sjs + file_path_matching.html + file_path_matching_incl_query.html + file_path_matching.js + file_path_matching_redirect.html + file_path_matching_redirect_server.sjs + file_testserver.sjs file_report_uri_missing_in_report_only_header.html file_report_uri_missing_in_report_only_header.html^headers^ - file_csp_report.html + file_report.html file_redirect_content.sjs file_redirect_report.sjs file_subframe_run_js_if_allowed.html @@ -112,42 +117,46 @@ support-files = file_form-action.html file_worker_redirect.html file_worker_redirect.sjs - file_csp_referrerdirective.html + file_referrerdirective.html referrerdirective.sjs [test_base-uri.html] +[test_blob_data_schemes.html] [test_connect-src.html] [test_CSP.html] -[test_csp_allow_https_schemes.html] +[test_allow_https_schemes.html] skip-if = buildapp == 'b2g' #no ssl support -[test_CSP_bug663567.html] -[test_CSP_bug802872.html] -[test_CSP_bug885433.html] -[test_CSP_bug888172.html] -[test_CSP_evalscript.html] -[test_CSP_frameancestors.html] +[test_bug663567.html] +[test_bug802872.html] +[test_bug885433.html] +[test_bug888172.html] +[test_evalscript.html] +[test_frameancestors.html] skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) || toolkit == 'android' # Times out, not sure why (bug 1008445) -[test_CSP_inlinescript.html] -[test_CSP_inlinestyle.html] -[test_csp_invalid_source_expression.html] +[test_inlinescript.html] +[test_inlinestyle.html] +[test_invalid_source_expression.html] [test_bug836922_npolicies.html] [test_bug886164.html] -[test_csp_redirects.html] -[test_CSP_bug910139.html] -[test_CSP_bug909029.html] +[test_redirects.html] +[test_bug910139.html] +[test_bug909029.html] [test_policyuri_regression_from_multipolicy.html] [test_nonce_source.html] -[test_CSP_bug941404.html] +[test_bug941404.html] [test_form-action.html] skip-if = e10s || buildapp == 'b2g' # http-on-opening-request observers are not available in child processes [test_hash_source.html] skip-if = e10s || buildapp == 'b2g' # can't compute hashes in child process (bug 958702) +[test_scheme_relative_sources.html] +skip-if = buildapp == 'b2g' #no ssl support +[test_ignore_unsafe_inline.html] [test_self_none_as_hostname_confusion.html] [test_bug949549.html] -[test_csp_path_matching.html] -[test_csp_path_matching_redirect.html] +[test_path_matching.html] +[test_path_matching_redirect.html] [test_report_uri_missing_in_report_only_header.html] -[test_csp_report.html] +[test_report.html] skip-if = e10s || buildapp == 'b2g' # http-on-opening-request observer not supported in child process (bug 1009632) [test_301_redirect.html] skip-if = buildapp == 'b2g' # intermittent orange (bug 1028490) @@ -161,6 +170,6 @@ skip-if = buildapp == 'b2g' # intermittent orange (bug 1028490) [test_leading_wildcard.html] [test_multi_policy_injection_bypass.html] [test_null_baseuri.html] -[test_CSP_referrerdirective.html] +[test_referrerdirective.html] skip-if = buildapp == 'b2g' #no ssl support [test_worker_redirect.html] diff --git a/dom/base/test/csp/referrerdirective.sjs b/dom/security/test/csp/referrerdirective.sjs similarity index 94% rename from dom/base/test/csp/referrerdirective.sjs rename to dom/security/test/csp/referrerdirective.sjs index 7af65722fe..f238ab4525 100644 --- a/dom/base/test/csp/referrerdirective.sjs +++ b/dom/security/test/csp/referrerdirective.sjs @@ -17,7 +17,7 @@ function handleRequest(request, response) { if (request.hasHeader('Referer')) { var referrer = request.getHeader('Referer'); - if (referrer.indexOf("file_csp_testserver.sjs") > -1) { + if (referrer.indexOf("file_testserver.sjs") > -1) { referrerLevel = "full"; } else { referrerLevel = "origin"; diff --git a/dom/base/test/csp/test_301_redirect.html b/dom/security/test/csp/test_301_redirect.html similarity index 100% rename from dom/base/test/csp/test_301_redirect.html rename to dom/security/test/csp/test_301_redirect.html diff --git a/dom/base/test/csp/test_302_redirect.html b/dom/security/test/csp/test_302_redirect.html similarity index 100% rename from dom/base/test/csp/test_302_redirect.html rename to dom/security/test/csp/test_302_redirect.html diff --git a/dom/base/test/csp/test_303_redirect.html b/dom/security/test/csp/test_303_redirect.html similarity index 100% rename from dom/base/test/csp/test_303_redirect.html rename to dom/security/test/csp/test_303_redirect.html diff --git a/dom/base/test/csp/test_307_redirect.html b/dom/security/test/csp/test_307_redirect.html similarity index 100% rename from dom/base/test/csp/test_307_redirect.html rename to dom/security/test/csp/test_307_redirect.html diff --git a/dom/base/test/csp/test_CSP.html b/dom/security/test/csp/test_CSP.html similarity index 98% rename from dom/base/test/csp/test_CSP.html rename to dom/security/test/csp/test_CSP.html index d3a5b53b65..2b508bd0d1 100644 --- a/dom/base/test/csp/test_CSP.html +++ b/dom/security/test/csp/test_CSP.html @@ -110,7 +110,7 @@ SpecialPowers.pushPrefEnv( function() { // save this for last so that our listeners are registered. // ... this loads the testbed of good and bad requests. - document.getElementById('cspframe').src = 'file_CSP_main.html'; + document.getElementById('cspframe').src = 'file_main.html'; }); diff --git a/dom/base/test/csp/test_csp_allow_https_schemes.html b/dom/security/test/csp/test_allow_https_schemes.html similarity index 92% rename from dom/base/test/csp/test_csp_allow_https_schemes.html rename to dom/security/test/csp/test_allow_https_schemes.html index a7784f5d20..454687bc9b 100644 --- a/dom/base/test/csp/test_csp_allow_https_schemes.html +++ b/dom/security/test/csp/test_allow_https_schemes.html @@ -18,7 +18,7 @@ SimpleTest.waitForExplicitFinish(); /* Description of the test: * We are loading the following url (including a fragment portion): - * https://example.com/tests/dom/base/test/csp/file_csp_path_matching.js#foo + * https://example.com/tests/dom/security/test/csp/file_path_matching.js#foo * using different policies that lack specification of a scheme. * * Since the file is served over http:, the upgrade to https should be @@ -40,9 +40,9 @@ function loadNextTest() { } else { policy = policies[counter++]; - var src = "file_csp_testserver.sjs"; + var src = "file_testserver.sjs"; // append the file that should be served - src += "?file=" + escape("tests/dom/base/test/csp/file_csp_allow_https_schemes.html"); + src += "?file=" + escape("tests/dom/security/test/csp/file_allow_https_schemes.html"); // append the CSP that should be used to serve the file src += "&csp=" + escape("default-src 'none'; script-src " + policy[1]); diff --git a/dom/base/test/csp/test_base-uri.html b/dom/security/test/csp/test_base-uri.html similarity index 93% rename from dom/base/test/csp/test_base-uri.html rename to dom/security/test/csp/test_base-uri.html index 1ec8babcb1..7e326401d3 100644 --- a/dom/base/test/csp/test_base-uri.html +++ b/dom/security/test/csp/test_base-uri.html @@ -65,9 +65,9 @@ function loadNextTest() { finishTest(); return; } - var src = "http://example.com/tests/dom/base/test/csp/file_csp_testserver.sjs"; + var src = "http://example.com/tests/dom/security/test/csp/file_testserver.sjs"; // append the file that should be served - src += "?file=" + escape("tests/dom/base/test/csp/file_base-uri.html"); + src += "?file=" + escape("tests/dom/security/test/csp/file_base-uri.html"); // append the CSP that should be used to serve the file src += "&csp=" + escape(testPolicies[counter]); document.getElementById("testframe").src = src; diff --git a/dom/security/test/csp/test_blob_data_schemes.html b/dom/security/test/csp/test_blob_data_schemes.html new file mode 100644 index 0000000000..37b327b102 --- /dev/null +++ b/dom/security/test/csp/test_blob_data_schemes.html @@ -0,0 +1,89 @@ + + + + Bug 1086999 - Wildcard should not match blob:, data: + + + + + + + + + + diff --git a/dom/base/test/csp/test_CSP_bug663567.html b/dom/security/test/csp/test_bug663567.html similarity index 88% rename from dom/base/test/csp/test_CSP_bug663567.html rename to dom/security/test/csp/test_bug663567.html index d61854726c..293aa29149 100644 --- a/dom/base/test/csp/test_CSP_bug663567.html +++ b/dom/security/test/csp/test_bug663567.html @@ -34,7 +34,7 @@ function checkAllowed () { * Content-Security-Policy: default-src 'self' * * we load the xsl file using: - * + * */ try { var cspframe = document.getElementById('xsltframe'); @@ -52,7 +52,7 @@ function checkBlocked () { * Content-Security-Policy: default-src *.example.com * * we load the xsl file using: - * + * */ try { var cspframe = document.getElementById('xsltframe2'); @@ -66,10 +66,10 @@ function checkBlocked () { } document.getElementById('xsltframe').addEventListener('load', checkAllowed, false); -document.getElementById('xsltframe').src = 'file_CSP_bug663567_allows.xml'; +document.getElementById('xsltframe').src = 'file_bug663567_allows.xml'; document.getElementById('xsltframe2').addEventListener('load', checkBlocked, false); -document.getElementById('xsltframe2').src = 'file_CSP_bug663567_blocks.xml'; +document.getElementById('xsltframe2').src = 'file_bug663567_blocks.xml'; diff --git a/dom/base/test/csp/test_csp_bug768029.html b/dom/security/test/csp/test_bug768029.html similarity index 96% rename from dom/base/test/csp/test_csp_bug768029.html rename to dom/security/test/csp/test_bug768029.html index 3e867076f1..a6a7bb2777 100644 --- a/dom/base/test/csp/test_csp_bug768029.html +++ b/dom/security/test/csp/test_bug768029.html @@ -35,7 +35,7 @@ var gData = [ app: "https://example.com/manifest.webapp", appStatus: Components.interfaces.nsIPrincipal.APP_STATUS_INSTALLED, origin: "https://example.com", - uri: "https://example.com/tests/dom/base/test/csp/file_csp_bug768029.html", + uri: "https://example.com/tests/dom/security/test/csp/file_bug768029.html", statusString: "installed app", expectedTestResults: { max_tests: 7, /* number of bools below plus one for the status check */ @@ -48,7 +48,7 @@ var gData = [ app: "https://example.com/manifest_priv.webapp", appStatus: Components.interfaces.nsIPrincipal.APP_STATUS_PRIVILEGED, origin: "https://example.com", - uri: "https://example.com/tests/dom/base/test/csp/file_csp_bug768029.html", + uri: "https://example.com/tests/dom/security/test/csp/file_bug768029.html", statusString: "privileged app", expectedTestResults: { max_tests: 7, /* number of bools below plus one for the status check */ @@ -61,7 +61,7 @@ var gData = [ app: "https://example.com/manifest_cert.webapp", appStatus: Components.interfaces.nsIPrincipal.APP_STATUS_CERTIFIED, origin: "https://example.com", - uri: "https://example.com/tests/dom/base/test/csp/file_csp_bug768029.html", + uri: "https://example.com/tests/dom/security/test/csp/file_bug768029.html", statusString: "certified app", expectedTestResults: { max_tests: 7, /* number of bools below plus one for the status check */ @@ -87,7 +87,7 @@ ThingyListener.prototype = { observe: function(subject, topic, data) { // make sure to only observe app-generated calls to the helper for this test. - var testpat = new RegExp("file_csp_bug768029\\.sjs"); + var testpat = new RegExp("file_bug768029\\.sjs"); // used to extract which kind of load this is (img, script, etc). var typepat = new RegExp("type=([\\_a-z0-9]+)"); diff --git a/dom/base/test/csp/test_csp_bug773891.html b/dom/security/test/csp/test_bug773891.html similarity index 97% rename from dom/base/test/csp/test_csp_bug773891.html rename to dom/security/test/csp/test_bug773891.html index beec40a86e..206708daca 100644 --- a/dom/base/test/csp/test_csp_bug773891.html +++ b/dom/security/test/csp/test_bug773891.html @@ -41,7 +41,7 @@ var gData = [ appStatus: Components.interfaces.nsIPrincipal.APP_STATUS_INSTALLED, csp: MANIFEST_CSP_INST, origin: "https://example.com", - uri: "https://example.com/tests/dom/base/test/csp/file_csp_bug773891.html", + uri: "https://example.com/tests/dom/security/test/csp/file_bug773891.html", statusString: "installed app", expectedTestResults: { max_tests: 7, /* number of bools below plus one for the status check */ @@ -54,7 +54,7 @@ var gData = [ appStatus: Components.interfaces.nsIPrincipal.APP_STATUS_CERTIFIED, csp: MANIFEST_CSP_CERT, origin: "https://example.com", - uri: "https://example.com/tests/dom/base/test/csp/file_csp_bug773891.html", + uri: "https://example.com/tests/dom/security/test/csp/file_bug773891.html", statusString: "certified app", expectedTestResults: { max_tests: 7, /* number of bools below plus one for the status check */ @@ -67,7 +67,7 @@ var gData = [ appStatus: Components.interfaces.nsIPrincipal.APP_STATUS_PRIVILEGED, csp: MANIFEST_CSP_PRIV, origin: "https://example.com", - uri: "https://example.com/tests/dom/base/test/csp/file_csp_bug773891.html", + uri: "https://example.com/tests/dom/security/test/csp/file_bug773891.html", statusString: "privileged app", expectedTestResults: { max_tests: 7, /* number of bools below plus one for the status check */ @@ -93,7 +93,7 @@ ThingyListener.prototype = { observe: function(subject, topic, data) { // make sure to only observe app-generated calls to the helper for this test. - var testpat = new RegExp("file_csp_bug773891\\.sjs"); + var testpat = new RegExp("file_bug773891\\.sjs"); // used to extract which kind of load this is (img, script, etc). var typepat = new RegExp("type=([\\_a-z0-9]+)"); diff --git a/dom/base/test/csp/test_CSP_bug802872.html b/dom/security/test/csp/test_bug802872.html similarity index 95% rename from dom/base/test/csp/test_CSP_bug802872.html rename to dom/security/test/csp/test_bug802872.html index 802a19ac3f..70584c14f3 100644 --- a/dom/base/test/csp/test_CSP_bug802872.html +++ b/dom/security/test/csp/test_bug802872.html @@ -46,7 +46,7 @@ addEventListener('blockedEventSrcCallbackFailed', function (e) { }, false); // load it -document.getElementById('eventframe').src = 'file_CSP_bug802872.html'; +document.getElementById('eventframe').src = 'file_bug802872.html'; diff --git a/dom/base/test/csp/test_bug836922_npolicies.html b/dom/security/test/csp/test_bug836922_npolicies.html similarity index 99% rename from dom/base/test/csp/test_bug836922_npolicies.html rename to dom/security/test/csp/test_bug836922_npolicies.html index 5e3dbe1f91..f9ddfa9d49 100644 --- a/dom/base/test/csp/test_bug836922_npolicies.html +++ b/dom/security/test/csp/test_bug836922_npolicies.html @@ -14,7 +14,7 @@ diff --git a/dom/base/test/csp/test_bug886164.html b/dom/security/test/csp/test_bug886164.html similarity index 99% rename from dom/base/test/csp/test_bug886164.html rename to dom/security/test/csp/test_bug886164.html index 2c46f75381..74fd984581 100644 --- a/dom/base/test/csp/test_bug886164.html +++ b/dom/security/test/csp/test_bug886164.html @@ -19,7 +19,7 @@ diff --git a/dom/base/test/csp/test_CSP_bug909029.html b/dom/security/test/csp/test_bug909029.html similarity index 96% rename from dom/base/test/csp/test_CSP_bug909029.html rename to dom/security/test/csp/test_bug909029.html index e682a864a4..aebfabf485 100644 --- a/dom/base/test/csp/test_CSP_bug909029.html +++ b/dom/security/test/csp/test_bug909029.html @@ -120,9 +120,9 @@ function checkInlineWithNone() { "Inline scripts should be blocked (style-src 'unsafe-inline' with none)"); } -document.getElementById('testframe1').src = 'file_CSP_bug909029_star.html'; +document.getElementById('testframe1').src = 'file_bug909029_star.html'; document.getElementById('testframe1').addEventListener('load', checkInlineWithStar, false); -document.getElementById('testframe2').src = 'file_CSP_bug909029_none.html'; +document.getElementById('testframe2').src = 'file_bug909029_none.html'; document.getElementById('testframe2').addEventListener('load', checkInlineWithNone, false); diff --git a/dom/base/test/csp/test_CSP_bug910139.html b/dom/security/test/csp/test_bug910139.html similarity index 87% rename from dom/base/test/csp/test_CSP_bug910139.html rename to dom/security/test/csp/test_bug910139.html index b784266dbb..63a7f77d1e 100644 --- a/dom/base/test/csp/test_CSP_bug910139.html +++ b/dom/security/test/csp/test_bug910139.html @@ -24,7 +24,7 @@ function checkAllowed () { * Content-Security-Policy: default-src 'self'; script-src 'self' * * we load the xsl file using: - * + * */ try { var cspframe = document.getElementById('xsltframe'); @@ -37,7 +37,7 @@ function checkAllowed () { // continue with the next test document.getElementById('xsltframe2').addEventListener('load', checkBlocked, false); - document.getElementById('xsltframe2').src = 'file_CSP_bug910139.sjs'; + document.getElementById('xsltframe2').src = 'file_bug910139.sjs'; } function checkBlocked () { @@ -45,7 +45,7 @@ function checkBlocked () { * Content-Security-Policy: default-src 'self'; script-src *.example.com * * we load the xsl file using: - * + * */ try { var cspframe = document.getElementById('xsltframe2'); @@ -59,7 +59,7 @@ function checkBlocked () { } document.getElementById('xsltframe').addEventListener('load', checkAllowed, false); -document.getElementById('xsltframe').src = 'file_CSP_bug910139.sjs'; +document.getElementById('xsltframe').src = 'file_bug910139.sjs'; diff --git a/dom/base/test/csp/test_CSP_bug941404.html b/dom/security/test/csp/test_bug941404.html similarity index 96% rename from dom/base/test/csp/test_CSP_bug941404.html rename to dom/security/test/csp/test_bug941404.html index 0735d3a71e..07f45d1769 100644 --- a/dom/base/test/csp/test_CSP_bug941404.html +++ b/dom/security/test/csp/test_bug941404.html @@ -17,7 +17,7 @@ diff --git a/dom/base/test/csp/test_bug949549.html b/dom/security/test/csp/test_bug949549.html similarity index 100% rename from dom/base/test/csp/test_bug949549.html rename to dom/security/test/csp/test_bug949549.html diff --git a/dom/base/test/csp/test_connect-src.html b/dom/security/test/csp/test_connect-src.html similarity index 75% rename from dom/base/test/csp/test_connect-src.html rename to dom/security/test/csp/test_connect-src.html index 9f3bef6f55..40972f8b51 100644 --- a/dom/base/test/csp/test_connect-src.html +++ b/dom/security/test/csp/test_connect-src.html @@ -1,7 +1,7 @@ - Bug 1031530 - Test mapping of XMLHttpRequest to connect-src + Bug 1031530 and Bug 1139667 - Test mapping of XMLHttpRequest and fetch() to connect-src @@ -16,7 +16,7 @@ /* * Description of the test: - * We load a page with a given CSP and verify that XMLHttpRequests are correctly + * We load a page with a given CSP and verify that XMLHttpRequests and fetches are correctly * evaluated through the "connect-src" directive. All XMLHttpRequests are served * using http://mochi.test:8888, which allows the requests to succeed for the first * two policies and to fail for the last policy. Please note that we have to add @@ -27,14 +27,32 @@ SimpleTest.waitForExplicitFinish(); var tests = [ { + file: "file_connect-src.html", result : "allowed", policy : "default-src 'none' script-src 'unsafe-inline'; connect-src http://mochi.test:8888" }, { + file: "file_connect-src.html", result : "allowed", policy : "default-src 'none'; script-src 'unsafe-inline'; connect-src *" }, { + file: "file_connect-src.html", + result : "blocked", + policy : "default-src 'none'; script-src 'unsafe-inline'; connect-src http://www.example.com" + }, + { + file: "file_connect-src-fetch.html", + result : "allowed", + policy : "default-src 'none' script-src 'unsafe-inline'; connect-src http://mochi.test:8888" + }, + { + file: "file_connect-src-fetch.html", + result : "allowed", + policy : "default-src 'none'; script-src 'unsafe-inline'; connect-src *" + }, + { + file: "file_connect-src-fetch.html", result : "blocked", policy : "default-src 'none'; script-src 'unsafe-inline'; connect-src http://www.example.com" } @@ -60,7 +78,7 @@ examiner.prototype = { if (topic === "specialpowers-http-notify-request") { // making sure we do not bubble a result for something other // then the request in question. - if (!data.includes("file_csp_testserver.sjs?foo")) { + if (!data.includes("file_testserver.sjs?foo")) { return; } checkResult("allowed"); @@ -73,7 +91,7 @@ examiner.prototype = { SpecialPowers.do_QueryInterface(subject, "nsIURI"), "asciiSpec"); - if (!asciiSpec.includes("file_csp_testserver.sjs?foo")) { + if (!asciiSpec.includes("file_testserver.sjs?foo")) { return; } checkResult("blocked"); @@ -94,9 +112,9 @@ function loadNextTest() { return; } - var src = "file_csp_testserver.sjs"; + var src = "file_testserver.sjs"; // append the file that should be served - src += "?file=" + escape("tests/dom/base/test/csp/file_connect-src.html"); + src += "?file=" + escape("tests/dom/security/test/csp/" + tests[counter].file); // append the CSP that should be used to serve the file src += "&csp=" + escape(tests[counter].policy); @@ -104,7 +122,9 @@ function loadNextTest() { } // start running the tests -loadNextTest(); +SpecialPowers.pushPrefEnv({"set": [ + ["dom.fetch.enabled", true] +]}, loadNextTest); diff --git a/dom/base/test/csp/test_CSP_evalscript.html b/dom/security/test/csp/test_evalscript.html similarity index 91% rename from dom/base/test/csp/test_CSP_evalscript.html rename to dom/security/test/csp/test_evalscript.html index a5c1d6a436..f0ec3407c9 100644 --- a/dom/base/test/csp/test_CSP_evalscript.html +++ b/dom/security/test/csp/test_evalscript.html @@ -51,8 +51,8 @@ SimpleTest.waitForExplicitFinish(); // save this for last so that our listeners are registered. // ... this loads the testbed of good and bad requests. -document.getElementById('cspframe').src = 'file_CSP_evalscript_main.html'; -document.getElementById('cspframe2').src = 'file_CSP_evalscript_main_allowed.html'; +document.getElementById('cspframe').src = 'file_evalscript_main.html'; +document.getElementById('cspframe2').src = 'file_evalscript_main_allowed.html'; diff --git a/dom/base/test/csp/test_form-action.html b/dom/security/test/csp/test_form-action.html similarity index 96% rename from dom/base/test/csp/test_form-action.html rename to dom/security/test/csp/test_form-action.html index 682e7a8d35..b909ca7019 100644 --- a/dom/base/test/csp/test_form-action.html +++ b/dom/security/test/csp/test_form-action.html @@ -88,9 +88,9 @@ function loadNextTest() { return; } - var src = "file_csp_testserver.sjs"; + var src = "file_testserver.sjs"; // append the file that should be served - src += "?file=" + escape("tests/dom/base/test/csp/" + tests[counter].page); + src += "?file=" + escape("tests/dom/security/test/csp/" + tests[counter].page); // append the CSP that should be used to serve the file src += "&csp=" + escape(tests[counter].policy); diff --git a/dom/base/test/csp/test_CSP_frameancestors.html b/dom/security/test/csp/test_frameancestors.html similarity index 97% rename from dom/base/test/csp/test_CSP_frameancestors.html rename to dom/security/test/csp/test_frameancestors.html index 87842f7800..8ccbc81566 100644 --- a/dom/base/test/csp/test_CSP_frameancestors.html +++ b/dom/security/test/csp/test_frameancestors.html @@ -73,7 +73,7 @@ examiner.prototype = { // skip checks on the test harness -- can't do this skipping for // cross-origin blocking since the observer doesn't get the URI. This // can cause this test to over-succeed (but only in specific cases). - if (asciiSpec.includes("test_CSP_frameancestors.html")) { + if (asciiSpec.includes("test_frameancestors.html")) { return; } } catch (ex) { @@ -149,7 +149,7 @@ SimpleTest.waitForExplicitFinish(); // save this for last so that our listeners are registered. // ... this loads the testbed of good and bad requests. -document.getElementById('cspframe').src = 'file_CSP_frameancestors_main.html'; +document.getElementById('cspframe').src = 'file_frameancestors_main.html'; diff --git a/dom/base/test/csp/test_hash_source.html b/dom/security/test/csp/test_hash_source.html similarity index 100% rename from dom/base/test/csp/test_hash_source.html rename to dom/security/test/csp/test_hash_source.html diff --git a/dom/security/test/csp/test_ignore_unsafe_inline.html b/dom/security/test/csp/test_ignore_unsafe_inline.html new file mode 100644 index 0000000000..915eba62d8 --- /dev/null +++ b/dom/security/test/csp/test_ignore_unsafe_inline.html @@ -0,0 +1,110 @@ + + + + Bug 1004703 - ignore 'unsafe-inline' if nonce- or hash-source specified + + + + + + + + + + diff --git a/dom/base/test/csp/test_CSP_inlinescript.html b/dom/security/test/csp/test_inlinescript.html similarity index 95% rename from dom/base/test/csp/test_CSP_inlinescript.html rename to dom/security/test/csp/test_inlinescript.html index 746e408477..31ddf60d1a 100644 --- a/dom/base/test/csp/test_CSP_inlinescript.html +++ b/dom/security/test/csp/test_inlinescript.html @@ -103,9 +103,9 @@ function clickit2() { // save this for last so that our listeners are registered. // ... this loads the testbed of good and bad requests. -document.getElementById('cspframe1').src = 'file_CSP_inlinescript_main.html'; +document.getElementById('cspframe1').src = 'file_inlinescript_main.html'; document.getElementById('cspframe1').addEventListener('load', clickit1, false); -document.getElementById('cspframe2').src = 'file_CSP_inlinescript_main_allowed.html'; +document.getElementById('cspframe2').src = 'file_inlinescript_main_allowed.html'; document.getElementById('cspframe2').addEventListener('load', clickit2, false); diff --git a/dom/base/test/csp/test_CSP_inlinestyle.html b/dom/security/test/csp/test_inlinestyle.html similarity index 97% rename from dom/base/test/csp/test_CSP_inlinestyle.html rename to dom/security/test/csp/test_inlinestyle.html index 22e9ba35a8..eadcf1e387 100644 --- a/dom/base/test/csp/test_CSP_inlinestyle.html +++ b/dom/security/test/csp/test_inlinestyle.html @@ -96,9 +96,9 @@ function checkIfDone() { // save this for last so that our listeners are registered. // ... this loads the testbed of good and bad requests. -document.getElementById('cspframe1').src = 'file_CSP_inlinestyle_main.html'; +document.getElementById('cspframe1').src = 'file_inlinestyle_main.html'; document.getElementById('cspframe1').addEventListener('load', checkStyles, false); -document.getElementById('cspframe2').src = 'file_CSP_inlinestyle_main_allowed.html'; +document.getElementById('cspframe2').src = 'file_inlinestyle_main_allowed.html'; document.getElementById('cspframe2').addEventListener('load', checkStylesAllowed, false); diff --git a/dom/base/test/csp/test_csp_invalid_source_expression.html b/dom/security/test/csp/test_invalid_source_expression.html similarity index 94% rename from dom/base/test/csp/test_csp_invalid_source_expression.html rename to dom/security/test/csp/test_invalid_source_expression.html index 8118d1c9a7..ad0b349998 100644 --- a/dom/base/test/csp/test_csp_invalid_source_expression.html +++ b/dom/security/test/csp/test_invalid_source_expression.html @@ -27,9 +27,9 @@ SimpleTest.waitForExplicitFinish(); const policy = "script-src bankid:/*"; function runTest() { - var src = "file_csp_testserver.sjs"; + var src = "file_testserver.sjs"; // append the file that should be served - src += "?file=" + escape("tests/dom/base/test/csp/file_csp_invalid_source_expression.html"); + src += "?file=" + escape("tests/dom/security/test/csp/file_invalid_source_expression.html"); // append the CSP that should be used to serve the file src += "&csp=" + escape(policy); diff --git a/dom/base/test/csp/test_leading_wildcard.html b/dom/security/test/csp/test_leading_wildcard.html similarity index 96% rename from dom/base/test/csp/test_leading_wildcard.html rename to dom/security/test/csp/test_leading_wildcard.html index 59903d3fbf..81c9f58ece 100644 --- a/dom/base/test/csp/test_leading_wildcard.html +++ b/dom/security/test/csp/test_leading_wildcard.html @@ -84,9 +84,9 @@ examiner.prototype = { window.wildCardExaminer = new examiner(); function runTest() { - var src = "file_csp_testserver.sjs"; + var src = "file_testserver.sjs"; // append the file that should be served - src += "?file=" + escape("tests/dom/base/test/csp/file_leading_wildcard.html"); + src += "?file=" + escape("tests/dom/security/test/csp/file_leading_wildcard.html"); // append the CSP that should be used to serve the file src += "&csp=" + escape(policy); diff --git a/dom/base/test/csp/test_multi_policy_injection_bypass.html b/dom/security/test/csp/test_multi_policy_injection_bypass.html similarity index 98% rename from dom/base/test/csp/test_multi_policy_injection_bypass.html rename to dom/security/test/csp/test_multi_policy_injection_bypass.html index 4db4392d46..83a9fa2650 100644 --- a/dom/base/test/csp/test_multi_policy_injection_bypass.html +++ b/dom/security/test/csp/test_multi_policy_injection_bypass.html @@ -19,7 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=717511 diff --git a/dom/base/test/csp/test_CSP_referrerdirective.html b/dom/security/test/csp/test_referrerdirective.html similarity index 96% rename from dom/base/test/csp/test_CSP_referrerdirective.html rename to dom/security/test/csp/test_referrerdirective.html index df36416310..497d946acb 100644 --- a/dom/base/test/csp/test_CSP_referrerdirective.html +++ b/dom/security/test/csp/test_referrerdirective.html @@ -112,10 +112,10 @@ SpecialPowers.pushPrefEnv({ // one iframe created for each test case for (var id in testData) { var elt = document.createElement("iframe"); - elt.src = "https://example.com/tests/dom/base/test/csp/file_csp_testserver.sjs?" + + elt.src = "https://example.com/tests/dom/security/test/csp/file_testserver.sjs?" + "id=" + id + "&csp=" + escape(testData[id]['csp']) + - "&file=tests/dom/base/test/csp/file_csp_referrerdirective.html"; + "&file=tests/dom/security/test/csp/file_referrerdirective.html"; document.getElementById("content").appendChild(elt); } }); diff --git a/dom/base/test/csp/test_csp_report.html b/dom/security/test/csp/test_report.html similarity index 94% rename from dom/base/test/csp/test_csp_report.html rename to dom/security/test/csp/test_report.html index 72805d4c75..2996d73ad8 100644 --- a/dom/base/test/csp/test_csp_report.html +++ b/dom/security/test/csp/test_report.html @@ -27,11 +27,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=548193 * observer, we can set the actual report-uri to a foo value. */ -const testfile = "tests/dom/base/test/csp/file_csp_report.html"; +const testfile = "tests/dom/security/test/csp/file_report.html"; const reportURI = "http://mochi.test:8888/foo.sjs"; const policy = "default-src 'none'; report-uri " + reportURI; -const docUri = "http://mochi.test:8888/tests/dom/base/test/csp/file_csp_testserver.sjs" + - "?file=tests/dom/base/test/csp/file_csp_report.html" + +const docUri = "http://mochi.test:8888/tests/dom/security/test/csp/file_testserver.sjs" + + "?file=tests/dom/security/test/csp/file_report.html" + "&csp=default-src%20%27none%27%3B%20report-uri%20http%3A//mochi.test%3A8888/foo.sjs"; window.checkResults = function(reportObj) { @@ -45,7 +45,7 @@ window.checkResults = function(reportObj) { is(cspReport["document-uri"], docUri, "Incorrect document-uri"); // we can not test for the whole referrer since it includes platform specific information - ok(cspReport["referrer"].startsWith("http://mochi.test:8888/tests/dom/base/test/csp/test_csp_report.html"), + ok(cspReport["referrer"].startsWith("http://mochi.test:8888/tests/dom/security/test/csp/test_report.html"), "Incorrect referrer"); is(cspReport["blocked-uri"], "self", "Incorrect blocked-uri"); @@ -130,7 +130,7 @@ SimpleTest.waitForExplicitFinish(); // load the resource which will generate a CSP violation report // save this for last so that our listeners are registered. -var src = "file_csp_testserver.sjs"; +var src = "file_testserver.sjs"; // append the file that should be served src += "?file=" + escape(testfile); // append the CSP that should be used to serve the file diff --git a/dom/base/test/csp/test_report_uri_missing_in_report_only_header.html b/dom/security/test/csp/test_report_uri_missing_in_report_only_header.html similarity index 100% rename from dom/base/test/csp/test_report_uri_missing_in_report_only_header.html rename to dom/security/test/csp/test_report_uri_missing_in_report_only_header.html diff --git a/dom/security/test/csp/test_scheme_relative_sources.html b/dom/security/test/csp/test_scheme_relative_sources.html new file mode 100644 index 0000000000..21271cdd1b --- /dev/null +++ b/dom/security/test/csp/test_scheme_relative_sources.html @@ -0,0 +1,91 @@ + + + + Bug 921493 - CSP: test whitelisting of scheme-relative sources + + + + + + + + + + diff --git a/dom/base/test/csp/test_self_none_as_hostname_confusion.html b/dom/security/test/csp/test_self_none_as_hostname_confusion.html similarity index 100% rename from dom/base/test/csp/test_self_none_as_hostname_confusion.html rename to dom/security/test/csp/test_self_none_as_hostname_confusion.html diff --git a/dom/base/test/csp/test_subframe_run_js_if_allowed.html b/dom/security/test/csp/test_subframe_run_js_if_allowed.html similarity index 100% rename from dom/base/test/csp/test_subframe_run_js_if_allowed.html rename to dom/security/test/csp/test_subframe_run_js_if_allowed.html diff --git a/dom/base/test/csp/test_worker_redirect.html b/dom/security/test/csp/test_worker_redirect.html similarity index 95% rename from dom/base/test/csp/test_worker_redirect.html rename to dom/security/test/csp/test_worker_redirect.html index a2dde2ebc3..62a43c77b3 100644 --- a/dom/base/test/csp/test_worker_redirect.html +++ b/dom/security/test/csp/test_worker_redirect.html @@ -60,9 +60,9 @@ function loadNextTest() { return; } curTest = tests[counter++]; - var src = "file_csp_testserver.sjs"; + var src = "file_testserver.sjs"; // append the file that should be served - src += "?file=" + escape("tests/dom/base/test/csp/file_worker_redirect.html"); + src += "?file=" + escape("tests/dom/security/test/csp/file_worker_redirect.html"); // append the CSP that should be used to serve the file src += "&csp=" + escape(curTest.policy); document.getElementById("testframe").src = src; diff --git a/dom/base/test/mixedcontentblocker/bug803225_test_mailto.html b/dom/security/test/mixedcontentblocker/file_bug803225_test_mailto.html similarity index 100% rename from dom/base/test/mixedcontentblocker/bug803225_test_mailto.html rename to dom/security/test/mixedcontentblocker/file_bug803225_test_mailto.html diff --git a/dom/base/test/mixedcontentblocker/file_mixed_content_frameNavigation.html b/dom/security/test/mixedcontentblocker/file_frameNavigation.html similarity index 85% rename from dom/base/test/mixedcontentblocker/file_mixed_content_frameNavigation.html rename to dom/security/test/mixedcontentblocker/file_frameNavigation.html index 36761cb190..fd9ea23178 100644 --- a/dom/base/test/mixedcontentblocker/file_mixed_content_frameNavigation.html +++ b/dom/security/test/mixedcontentblocker/file_frameNavigation.html @@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=840388
" + + "" + + ""; + +add_task(function*() { + let tab = yield addTab(TEST_URL); + let {inspector} = yield openInspector(); + let domContentLoaded = waitForLinkedBrowserEvent(tab, "DOMContentLoaded"); + let pageLoaded = waitForLinkedBrowserEvent(tab, "load"); + + ok (inspector.markup, "There is a markup view"); + + // Select an element while the tab is in the middle of a slow reload. + reloadTab(); + yield domContentLoaded; + yield chooseWithInspectElementContextMenu("img"); + yield pageLoaded; + + yield inspector.once("markuploaded"); + ok (inspector.markup, "There is a markup view"); + is (inspector.markup._elt.children.length, 1, "The markup view is rendering"); +}); + +function* chooseWithInspectElementContextMenu(selector) { + yield executeInContent("Test:SynthesizeMouse", { + center: true, + selector: selector, + options: {type: "contextmenu", button: 2} + }); + executeInContent("Test:SynthesizeKey", {key: "Q", options: {}}); +} + +function waitForLinkedBrowserEvent(tab, event) { + let def = promise.defer(); + tab.linkedBrowser.addEventListener(event, function cb() { + tab.linkedBrowser.removeEventListener(event, cb, true); + def.resolve(); + }, true); + return def.promise; +} diff --git a/toolkit/devtools/markupview/test/browser_markupview_mutation_01.js b/toolkit/devtools/markupview/test/browser_markupview_mutation_01.js index e5a600041d..68f32535bc 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_mutation_01.js +++ b/toolkit/devtools/markupview/test/browser_markupview_mutation_01.js @@ -33,13 +33,36 @@ const TEST_DATA = [ node1.removeAttribute("newattr"); }, check: function*(inspector) { - // The markup-view is a little weird in that it doesn't remove the - // attribute but only hides it with display:none + let {editor} = yield getContainerForSelector("#node1", inspector); + ok(![...editor.attrList.querySelectorAll(".attreditor")].some(attr => { + return attr.textContent.trim() === "newattr=\"newattrval\""; + }), "newattr attribute removed"); + } + }, + { + desc: "Re-adding an attribute", + test: () => { + let node1 = getNode("#node1"); + node1.setAttribute("newattr", "newattrval"); + }, + check: function*(inspector) { let {editor} = yield getContainerForSelector("#node1", inspector); ok([...editor.attrList.querySelectorAll(".attreditor")].some(attr => { - return attr.textContent.trim() === "newattr=\"newattrval\"" && - attr.style.display === "none"; - }), "newattr attribute removed"); + return attr.textContent.trim() === "newattr=\"newattrval\""; + }), "newattr attribute found"); + } + }, + { + desc: "Changing an attribute", + test: () => { + let node1 = getNode("#node1"); + node1.setAttribute("newattr", "newattrchanged"); + }, + check: function*(inspector) { + let {editor} = yield getContainerForSelector("#node1", inspector); + ok([...editor.attrList.querySelectorAll(".attreditor")].some(attr => { + return attr.textContent.trim() === "newattr=\"newattrchanged\""; + }), "newattr attribute found"); } }, { diff --git a/toolkit/devtools/markupview/test/browser_markupview_mutation_02.js b/toolkit/devtools/markupview/test/browser_markupview_mutation_02.js index c55479ae96..387e84b2fd 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_mutation_02.js +++ b/toolkit/devtools/markupview/test/browser_markupview_mutation_02.js @@ -13,6 +13,8 @@ const TEST_URL = TEST_URL_ROOT + "doc_markup_flashing.html"; // Each item is an object: // - desc: a description of the test step, for better logging // - mutate: a function that should make changes to the content DOM +// - attribute: if set, the test will expect the corresponding attribute to flash +// instead of the whole node // - flashedNode: [optional] the css selector of the node that is expected to // flash in the markup-view as a result of the mutation. // If missing, the rootNode (".list") will be expected to flash @@ -36,15 +38,28 @@ const TEST_DATA = [{ }, flashedNode: ".list .item:last-child" }, { - desc: "Adding an attribute should flash the node", + desc: "Adding an attribute should flash the attribute", + attribute: "test-name", mutate: (doc, rootNode) => { - rootNode.setAttribute("name-" + Date.now(), "value-" + Date.now()); + rootNode.setAttribute("test-name", "value-" + Date.now()); } }, { - desc: "Editing an attribute should flash the node", + desc: "Editing an attribute should flash the attribute", + attribute: "class", mutate: (doc, rootNode) => { rootNode.setAttribute("class", "list value-" + Date.now()); } +}, { + desc: "Multiple changes to an attribute should flash the attribute", + attribute: "class", + mutate: (doc, rootNode) => { + rootNode.removeAttribute("class"); + rootNode.setAttribute("class", "list value-" + Date.now()); + rootNode.setAttribute("class", "list value-" + Date.now()); + rootNode.removeAttribute("class"); + rootNode.setAttribute("class", "list value-" + Date.now()); + rootNode.setAttribute("class", "list value-" + Date.now()); + } }, { desc: "Removing an attribute should flash the node", mutate: (doc, rootNode) => { @@ -66,7 +81,7 @@ add_task(function*() { info("Selecting the last element of the root node before starting"); yield selectNode(".list .item:nth-child(2)", inspector); - for (let {mutate, flashedNode, desc} of TEST_DATA) { + for (let {mutate, flashedNode, desc, attribute} of TEST_DATA) { info("Starting test: " + desc); info("Mutating the DOM and listening for markupmutation event"); @@ -80,7 +95,12 @@ add_task(function*() { if (flashedNode) { flashingNodeFront = yield getNodeFront(flashedNode, inspector); } - yield assertNodeFlashing(flashingNodeFront, inspector); + + if (attribute) { + yield assertAttributeFlashing(flashingNodeFront, attribute, inspector); + } else { + yield assertNodeFlashing(flashingNodeFront, inspector); + } // Making sure the inspector has finished updating before moving on yield updated; @@ -95,6 +115,20 @@ function* assertNodeFlashing(nodeFront, inspector) { // Clear the mutation flashing timeout now that we checked the node was flashing let markup = inspector.markup; - markup._frame.contentWindow.clearTimeout(container._flashMutationTimer); + clearTimeout(container._flashMutationTimer); container._flashMutationTimer = null; + container.tagState.classList.remove("theme-bg-contrast"); +} + +function* assertAttributeFlashing(nodeFront, attribute, inspector) { + let container = getContainerForNodeFront(nodeFront, inspector); + ok(container, "Markup container for node found"); + ok(container.editor.attrElements.get(attribute), "Attribute exists on editor"); + + let attributeElement = container.editor.getAttributeElement(attribute); + + ok(attributeElement.classList.contains("theme-bg-contrast"), + "Element for " + attribute + " attribute is flashing"); + + attributeElement.classList.remove("theme-bg-contrast"); } diff --git a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_02.js b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_02.js index acbeda4495..ead723c5c4 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_02.js +++ b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_02.js @@ -16,20 +16,20 @@ add_task(function*() { yield selectNode("#test-div", inspector); info("Verify attributes, only ID should be there for now"); - assertAttributes("#test-div", { + yield assertAttributes("#test-div", { id: "test-div" }); info("Focus the ID attribute and change its content"); let {editor} = yield getContainerForSelector("#test-div", inspector); - let attr = editor.attrs["id"].querySelector(".editable"); + let attr = editor.attrElements.get("id").querySelector(".editable"); let mutated = inspector.once("markupmutation"); setEditableFieldValue(attr, attr.textContent + ' class="newclass" style="color:green"', inspector); yield mutated; info("Verify attributes, should have ID, class and style"); - assertAttributes("#test-div", { + yield assertAttributes("#test-div", { id: "test-div", class: "newclass", style: "color:green" @@ -37,7 +37,7 @@ add_task(function*() { info("Trying to undo the change"); yield undoChange(inspector); - assertAttributes("#test-div", { + yield assertAttributes("#test-div", { id: "test-div" }); diff --git a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_03.js b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_03.js index 957e1093de..b24a07da98 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_03.js +++ b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_03.js @@ -14,26 +14,37 @@ add_task(function*() { yield inspector.markup.expandAll(); info("Selecting the test node"); - let node = content.document.querySelector("#retag-me"); - let child = content.document.querySelector("#retag-me-2"); yield selectNode("#retag-me", inspector); + info("Getting the markup-container for the test node"); let container = yield getContainerForSelector("#retag-me", inspector); - is(node.tagName, "DIV", "We've got #retag-me element, it's a DIV"); - ok(container.expanded, "It is expanded"); - is(child.parentNode, node, "Child #retag-me-2 is inside #retag-me"); + ok(container.expanded, "The container is expanded"); - info("Changing the tagname"); + let parentInfo = yield getNodeInfo("#retag-me"); + is(parentInfo.tagName.toLowerCase(), "div", + "We've got #retag-me element, it's a DIV"); + is(parentInfo.numChildren, 1, "#retag-me has one child"); + let childInfo = yield getNodeInfo("#retag-me > *"); + is(childInfo.attributes[0].value, "retag-me-2", + "#retag-me's only child is #retag-me-2"); + + info("Changing #retag-me's tagname in the markup-view"); let mutated = inspector.once("markupmutation"); let tagEditor = container.editor.tag; setEditableFieldValue(tagEditor, "p", inspector); yield mutated; - info("Checking that the tagname change was done"); - node = content.document.querySelector("#retag-me"); + info("Checking that the markup-container exists and is correct"); container = yield getContainerForSelector("#retag-me", inspector); - is(node.tagName, "P", "We've got #retag-me, it should now be a P"); - ok(container.expanded, "It is still expanded"); - ok(container.selected, "It is still selected"); - is(child.parentNode, node, "Child #retag-me-2 is still inside #retag-me"); + ok(container.expanded, "The container is still expanded"); + ok(container.selected, "The container is still selected"); + + info("Checking that the tagname change was done"); + parentInfo = yield getNodeInfo("#retag-me"); + is(parentInfo.tagName.toLowerCase(), "p", + "The #retag-me element is now a P"); + is(parentInfo.numChildren, 1, "#retag-me still has one child"); + childInfo = yield getNodeInfo("#retag-me > *"); + is(childInfo.attributes[0].value, "retag-me-2", + "#retag-me's only child is #retag-me-2"); }); diff --git a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_06.js b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_06.js index e11db55536..31be4b6dbd 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_06.js +++ b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_06.js @@ -66,8 +66,8 @@ let TEST_DATA = [{ desc: "Object attribute names", text: "toString=\"true\" hasOwnProperty=\"false\"", expectedAttributes: { - toString: "true", - hasOwnProperty: "false" + tostring: "true", + hasownproperty: "false" } }, { desc: "Add event handlers", diff --git a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_07.js b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_07.js index 8d221ea962..eeb7419075 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_07.js +++ b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_07.js @@ -47,7 +47,7 @@ let TEST_DATA = [{ }, validate: (element, container, inspector) => { let editor = container.editor; - let visibleAttrText = editor.attrs["style"].querySelector(".attr-value").textContent; + let visibleAttrText = editor.attrElements.get("style").querySelector(".attr-value").textContent; is (visibleAttrText, DATA_URL_INLINE_STYLE_COLLAPSED); } }, { @@ -58,7 +58,7 @@ let TEST_DATA = [{ }, validate: (element, container, inspector) => { let editor = container.editor; - let visibleAttrText = editor.attrs["data-long"].querySelector(".attr-value").textContent; + let visibleAttrText = editor.attrElements.get("data-long").querySelector(".attr-value").textContent; is (visibleAttrText, LONG_ATTRIBUTE_COLLAPSED) } }, { @@ -69,7 +69,7 @@ let TEST_DATA = [{ }, validate: (element, container, inspector) => { let editor = container.editor; - let visibleAttrText = editor.attrs["src"].querySelector(".attr-value").textContent; + let visibleAttrText = editor.attrElements.get("src").querySelector(".attr-value").textContent; is (visibleAttrText, DATA_URL_ATTRIBUTE_COLLAPSED); } }]; diff --git a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_08.js b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_08.js index ba8217039a..1902582f22 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_08.js +++ b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_08.js @@ -25,19 +25,18 @@ function* testCollapsedLongAttribute(inspector) { info("Adding test attributes to the node"); let onMutated = inspector.once("markupmutation"); - let node = getNode("#node24"); - node.setAttribute("class", ""); - node.setAttribute("data-long", LONG_ATTRIBUTE); + yield setNodeAttribute("#node24", "class", ""); + yield setNodeAttribute("#node24", "data-long", LONG_ATTRIBUTE); yield onMutated; - assertAttributes("#node24", { + yield assertAttributes("#node24", { id: "node24", "class": "", "data-long": LONG_ATTRIBUTE }); let {editor} = yield getContainerForSelector("#node24", inspector); - let attr = editor.attrs["data-long"].querySelector(".editable"); + let attr = editor.attrElements.get("data-long").querySelector(".editable"); // Check to make sure it has expanded after focus attr.focus(); @@ -49,10 +48,10 @@ function* testCollapsedLongAttribute(inspector) { setEditableFieldValue(attr, input.value + ' data-short="ABC"', inspector); yield inspector.once("markupmutation"); - let visibleAttrText = editor.attrs["data-long"].querySelector(".attr-value").textContent; + let visibleAttrText = editor.attrElements.get("data-long").querySelector(".attr-value").textContent; is (visibleAttrText, LONG_ATTRIBUTE_COLLAPSED) - assertAttributes("#node24", { + yield assertAttributes("#node24", { id: "node24", class: "", 'data-long': LONG_ATTRIBUTE, @@ -63,14 +62,14 @@ function* testCollapsedLongAttribute(inspector) { function* testModifyInlineStyleWithQuotes(inspector) { info("Modify inline style containing \""); - assertAttributes("#node26", { + yield assertAttributes("#node26", { id: "node26", style: 'background-image: url("moz-page-thumb://thumbnail?url=http%3A%2F%2Fwww.mozilla.org%2F");' }); let onMutated = inspector.once("markupmutation"); let {editor} = yield getContainerForSelector("#node26", inspector); - let attr = editor.attrs["style"].querySelector(".editable"); + let attr = editor.attrElements.get("style").querySelector(".editable"); attr.focus(); EventUtils.sendKey("return", inspector.panelWin); @@ -90,7 +89,7 @@ function* testModifyInlineStyleWithQuotes(inspector) { yield onMutated; - assertAttributes("#node26", { + yield assertAttributes("#node26", { id: "node26", style: 'background-image: url("moz-page-thumb://thumbnail?url=http%3A%2F%2Fwww.mozilla.com%2F");' }); @@ -99,14 +98,14 @@ function* testModifyInlineStyleWithQuotes(inspector) { function* testEditingAttributeWithMixedQuotes(inspector) { info("Modify class containing \" and \'"); - assertAttributes("#node27", { + yield assertAttributes("#node27", { "id": "node27", "class": 'Double " and single \'' }); let onMutated = inspector.once("markupmutation"); let {editor} = yield getContainerForSelector("#node27", inspector); - let attr = editor.attrs["class"].querySelector(".editable"); + let attr = editor.attrElements.get("class").querySelector(".editable"); attr.focus(); EventUtils.sendKey("return", inspector.panelWin); @@ -123,7 +122,7 @@ function* testEditingAttributeWithMixedQuotes(inspector) { yield onMutated; - assertAttributes("#node27", { + yield assertAttributes("#node27", { id: "node27", class: '" " and \' \'' }); diff --git a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_09.js b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_09.js index f175962f0d..2e28c00cb1 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_tag_edit_09.js +++ b/toolkit/devtools/markupview/test/browser_markupview_tag_edit_09.js @@ -27,7 +27,7 @@ function* testWellformedMixedCase(inspector) { info("Focusing the viewBox attribute editor"); let {editor} = yield getContainerForSelector("svg", inspector); - let attr = editor.attrs["viewBox"].querySelector(".editable"); + let attr = editor.attrElements.get("viewBox").querySelector(".editable"); attr.focus(); EventUtils.sendKey("return", inspector.panelWin); @@ -37,7 +37,7 @@ function* testWellformedMixedCase(inspector) { EventUtils.sendKey("return", inspector.panelWin); yield onMutated; - assertAttributes("svg", { + yield assertAttributes("svg", { "viewBox": "0 0 1 1", "width": "200", "height": "200" @@ -53,7 +53,7 @@ function* testMalformedMixedCase(inspector) { info("Focusing the viewBox attribute editor"); let {editor} = yield getContainerForSelector("svg", inspector); - let attr = editor.attrs["viewBox"].querySelector(".editable"); + let attr = editor.attrElements.get("viewBox").querySelector(".editable"); attr.focus(); EventUtils.sendKey("return", inspector.panelWin); @@ -63,7 +63,7 @@ function* testMalformedMixedCase(inspector) { EventUtils.sendKey("return", inspector.panelWin); yield onMutated; - assertAttributes("svg", { + yield assertAttributes("svg", { "viewBox": "<>", "width": "200", "height": "200" diff --git a/toolkit/devtools/markupview/test/browser_markupview_textcontent_edit_01.js b/toolkit/devtools/markupview/test/browser_markupview_textcontent_edit_01.js index 3711e73581..a98c036897 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_textcontent_edit_01.js +++ b/toolkit/devtools/markupview/test/browser_markupview_textcontent_edit_01.js @@ -31,15 +31,3 @@ add_task(function*() { yield inspector.once("inspector-updated"); }); - -// The expand all operation of the markup-view calls itself recursively and -// there's not one event we can wait for to know when it's done -function* waitForMultipleChildrenUpdates(inspector) { - // As long as child updates are queued up while we wait for an update already - // wait again - if (inspector.markup._queuedChildUpdates && - inspector.markup._queuedChildUpdates.size) { - yield waitForChildrenUpdated(inspector); - return yield waitForMultipleChildrenUpdates(inspector); - } -} diff --git a/toolkit/devtools/markupview/test/browser_markupview_toggle_03.js b/toolkit/devtools/markupview/test/browser_markupview_toggle_03.js index b643bc1236..0dcc6530d4 100644 --- a/toolkit/devtools/markupview/test/browser_markupview_toggle_03.js +++ b/toolkit/devtools/markupview/test/browser_markupview_toggle_03.js @@ -33,15 +33,3 @@ add_task(function*() { "Container for node " + nodeFront.tagName + " is expanded"); } }); - -// The expand all operation of the markup-view calls itself recursively and -// there's not one event we can wait for to know when it's done -function* waitForMultipleChildrenUpdates(inspector) { - // As long as child updates are queued up while we wait for an update already - // wait again - if (inspector.markup._queuedChildUpdates && - inspector.markup._queuedChildUpdates.size) { - yield waitForChildrenUpdated(inspector); - return yield waitForMultipleChildrenUpdates(inspector); - } -} diff --git a/toolkit/devtools/markupview/test/doc_markup_dragdrop.html b/toolkit/devtools/markupview/test/doc_markup_dragdrop.html new file mode 100644 index 0000000000..07b50b8f3c --- /dev/null +++ b/toolkit/devtools/markupview/test/doc_markup_dragdrop.html @@ -0,0 +1,31 @@ + + + + + + Test for Bug 858038 + + + + Mozilla Bug 858038 +

+ + + + Before +
+    First
+    Middle
+    Last
+  
+ After + + diff --git a/toolkit/devtools/markupview/test/doc_markup_dragdrop_autoscroll.html b/toolkit/devtools/markupview/test/doc_markup_dragdrop_autoscroll.html new file mode 100644 index 0000000000..f3f534a6f6 --- /dev/null +++ b/toolkit/devtools/markupview/test/doc_markup_dragdrop_autoscroll.html @@ -0,0 +1,51 @@ + + + + + + Test for Bug 858038 - Autoscroll + + +
+ Mozilla Bug 858038 +

Test

+ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/toolkit/devtools/markupview/test/doc_markup_links.html b/toolkit/devtools/markupview/test/doc_markup_links.html new file mode 100644 index 0000000000..f393319f8d --- /dev/null +++ b/toolkit/devtools/markupview/test/doc_markup_links.html @@ -0,0 +1,42 @@ + + + + + Markup-view links + + + + + +

+ + +

+

+ + +

+

+ +

+ Thank you for your message! + + Click me, I'm a link +
    +
  • Item 1
  • +
  • Item 2
  • +
  • Item 3
  • +
+ + + + + + + + + + + + + diff --git a/toolkit/devtools/markupview/test/head.js b/toolkit/devtools/markupview/test/head.js index 6eb5ac08db..3f41406e8f 100644 --- a/toolkit/devtools/markupview/test/head.js +++ b/toolkit/devtools/markupview/test/head.js @@ -9,6 +9,7 @@ let {console} = Cu.import("resource://gre/modules/devtools/Console.jsm", {}); let promise = devtools.require("resource://gre/modules/Promise.jsm").Promise; let {getInplaceEditorForSpan: inplaceEditor} = devtools.require("devtools/shared/inplace-editor"); let clipboard = devtools.require("sdk/clipboard"); +let {setTimeout, clearTimeout} = devtools.require("sdk/timers"); // All test are asynchronous waitForExplicitFinish(); @@ -47,6 +48,7 @@ registerCleanupFunction(function*() { const TEST_URL_ROOT = "http://mochi.test:8888/browser/browser/devtools/markupview/test/"; const CHROME_BASE = "chrome://mochitests/content/browser/browser/devtools/markupview/test/"; +const COMMON_FRAME_SCRIPT_URL = "chrome://browser/content/devtools/frame-script-utils.js"; /** * Add a new test tab in the browser and load the given url. @@ -65,6 +67,9 @@ function addTab(url) { let tab = window.gBrowser.selectedTab = window.gBrowser.addTab(url); let linkedBrowser = tab.linkedBrowser; + info("Loading the helper frame script " + COMMON_FRAME_SCRIPT_URL); + linkedBrowser.messageManager.loadFrameScript(COMMON_FRAME_SCRIPT_URL, false); + linkedBrowser.addEventListener("load", function onload() { linkedBrowser.removeEventListener("load", onload, true); info("URL '" + url + "' loading complete"); @@ -123,6 +128,57 @@ function openInspector() { return def.promise; } +/** + * Wait for a content -> chrome message on the message manager (the window + * messagemanager is used). + * @param {String} name The message name + * @return {Promise} A promise that resolves to the response data when the + * message has been received + */ +function waitForContentMessage(name) { + info("Expecting message " + name + " from content"); + + let mm = gBrowser.selectedBrowser.messageManager; + + let def = promise.defer(); + mm.addMessageListener(name, function onMessage(msg) { + mm.removeMessageListener(name, onMessage); + def.resolve(msg.data); + }); + return def.promise; +} + +/** + * Send an async message to the frame script (chrome -> content) and wait for a + * response message with the same name (content -> chrome). + * @param {String} name The message name. Should be one of the messages defined + * in doc_frame_script.js + * @param {Object} data Optional data to send along + * @param {Object} objects Optional CPOW objects to send along + * @param {Boolean} expectResponse If set to false, don't wait for a response + * with the same name from the content script. Defaults to true. + * @return {Promise} Resolves to the response data if a response is expected, + * immediately resolves otherwise + */ +function executeInContent(name, data={}, objects={}, expectResponse=true) { + info("Sending message " + name + " to content"); + let mm = gBrowser.selectedBrowser.messageManager; + + mm.sendAsyncMessage(name, data, objects); + if (expectResponse) { + return waitForContentMessage(name); + } else { + return promise.resolve(); + } +} + +/** + * Reload the current tab location. + */ +function reloadTab() { + return executeInContent("devtools:test:reload", {}, {}, false); +} + /** * Simple DOM node accesor function that takes either a node or a string css * selector as argument and returns the corresponding node @@ -151,6 +207,27 @@ function getNodeFront(selector, {walker}) { return walker.querySelector(walker.rootNode, selector); } +/** + * Get information about a DOM element, identified by its selector. + * @param {String} selector. + * @return {Promise} a promise that resolves to the element's information. + */ +function getNodeInfo(selector) { + return executeInContent("devtools:test:getDomElementInfo", {selector}); +} + +/** + * Set the value of an attribute of a DOM element, identified by its selector. + * @param {String} selector. + * @param {String} attributeName. + * @param {String} attributeValue. + * @param {Promise} resolves when done. + */ +function setNodeAttribute(selector, attributeName, attributeValue) { + return executeInContent("devtools:test:setAttribute", + {selector, attributeName, attributeValue}); +} + /** * Highlight a node and set the inspector's current selection to the node or * the first match of the given css selector. @@ -304,25 +381,28 @@ let addNewAttributes = Task.async(function*(selector, text, inspector) { }); /** - * Checks that a node has the given attributes + * Checks that a node has the given attributes. * - * @param {String} selector The node or node selector to check. - * @param {Object} attrs An object containing the attributes to check. + * @param {String} selector The selector for the node to check. + * @param {Object} expected An object containing the attributes to check. * e.g. {id: "id1", class: "someclass"} * * Note that node.getAttribute() returns attribute values provided by the HTML * parser. The parser only provides unescaped entities so & will return &. */ -function assertAttributes(selector, attrs) { - let node = getNode(selector); +let assertAttributes = Task.async(function*(selector, expected) { + let {attributes: actual} = yield getNodeInfo(selector); - is(node.attributes.length, Object.keys(attrs).length, - "Node has the correct number of attributes."); - for (let attr in attrs) { - is(node.getAttribute(attr), attrs[attr], - "Node has the correct " + attr + " attribute."); + is(actual.length, Object.keys(expected).length, + "The node " + selector + " has the expected number of attributes."); + for (let attr in expected) { + let foundAttr = actual.find(({name, value}) => name === attr); + let foundValue = foundAttr ? foundAttr.value : undefined; + ok(foundAttr, "The node " + selector + " has the attribute " + attr); + is(foundValue, expected[attr], + "The node " + selector + " has the correct " + attr + " attribute value"); } -} +}); /** * Undo the last markup-view action and wait for the corresponding mutation to @@ -561,3 +641,61 @@ function checkFocusedAttribute(attrName, editMode) { editMode ? "input": "span", editMode ? attrName + " is in edit mode" : attrName + " is not in edit mode"); } + +// The expand all operation of the markup-view calls itself recursively and +// there's not one event we can wait for to know when it's done +// so use this helper function to wait until all recursive children updates are done. +function* waitForMultipleChildrenUpdates(inspector) { + // As long as child updates are queued up while we wait for an update already + // wait again + if (inspector.markup._queuedChildUpdates && + inspector.markup._queuedChildUpdates.size) { + yield waitForChildrenUpdated(inspector); + return yield waitForMultipleChildrenUpdates(inspector); + } +} + +/** + * Create an HTTP server that can be used to simulate custom requests within + * a test. It is automatically cleaned up when the test ends, so no need to + * call `destroy`. + * + * See https://developer.mozilla.org/en-US/docs/Httpd.js/HTTP_server_for_unit_tests + * for more information about how to register handlers. + * + * The server can be accessed like: + * + * const server = createTestHTTPServer(); + * let url = "http://localhost: " + server.identity.primaryPort + "/path"; + * + * @returns {HttpServer} + */ +function createTestHTTPServer() { + const {HttpServer} = Cu.import("resource://testing-common/httpd.js", {}); + let server = new HttpServer(); + + registerCleanupFunction(function* cleanup() { + let destroyed = promise.defer(); + server.stop(() => { + destroyed.resolve(); + }); + yield destroyed.promise; + }); + + server.start(-1); + return server; +} + +/** + * A helper that simulates a contextmenu event on the given chrome DOM element. + */ +function contextMenuClick(element) { + let evt = element.ownerDocument.createEvent('MouseEvents'); + let button = 2; // right click + + evt.initMouseEvent('contextmenu', true, true, + element.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, + false, false, false, button, null); + + element.dispatchEvent(evt); +} diff --git a/toolkit/devtools/markupview/test/helper_attributes_test_runner.js b/toolkit/devtools/markupview/test/helper_attributes_test_runner.js index dc8040c890..faf29f6ce2 100644 --- a/toolkit/devtools/markupview/test/helper_attributes_test_runner.js +++ b/toolkit/devtools/markupview/test/helper_attributes_test_runner.js @@ -58,7 +58,7 @@ function* runAddAttributesTest(test, selector, inspector) { yield addNewAttributes(selector, test.text, inspector); info("Assert that the attribute(s) has/have been applied correctly"); - assertAttributes(element, test.expectedAttributes); + yield assertAttributes(selector, test.expectedAttributes); if (test.validate) { let container = yield getContainerForSelector(selector, inspector); @@ -69,7 +69,7 @@ function* runAddAttributesTest(test, selector, inspector) { yield undoChange(inspector); info("Assert that the attribute(s) has/have been removed correctly"); - assertAttributes(element, {}); + yield assertAttributes(selector, {}); } /** @@ -123,7 +123,7 @@ function* runEditAttributesTest(test, inspector) { yield selectNode(test.node, inspector); info("Asserting that the node has the right attributes to start with"); - assertAttributes(test.node, test.originalAttributes); + yield assertAttributes(test.node, test.originalAttributes); info("Editing attribute " + test.name + " with value " + test.value); @@ -133,18 +133,18 @@ function* runEditAttributesTest(test, inspector) { info("Listening for the markupmutation event"); let nodeMutated = inspector.once("markupmutation"); - let attr = container.editor.attrs[test.name].querySelector(".editable"); + let attr = container.editor.attrElements.get(test.name).querySelector(".editable"); setEditableFieldValue(attr, test.value, inspector); yield nodeMutated; info("Asserting the new attributes after edition"); - assertAttributes(test.node, test.expectedAttributes); + yield assertAttributes(test.node, test.expectedAttributes); info("Undo the change and assert that the attributes have been changed back"); yield undoChange(inspector); - assertAttributes(test.node, test.originalAttributes); + yield assertAttributes(test.node, test.originalAttributes); info("Redo the change and assert that the attributes have been changed again"); yield redoChange(inspector); - assertAttributes(test.node, test.expectedAttributes); + yield assertAttributes(test.node, test.expectedAttributes); } diff --git a/toolkit/devtools/server/HeapSnapshot.cpp b/toolkit/devtools/server/HeapSnapshot.cpp index d6d5dd3d52..d7a9ef16ac 100644 --- a/toolkit/devtools/server/HeapSnapshot.cpp +++ b/toolkit/devtools/server/HeapSnapshot.cpp @@ -27,6 +27,7 @@ #include "nsIOutputStream.h" #include "nsISupportsImpl.h" #include "nsNetUtil.h" +#include "nsIFile.h" #include "prerror.h" #include "prio.h" #include "prtypes.h" diff --git a/toolkit/devtools/server/actors/inspector.js b/toolkit/devtools/server/actors/inspector.js index de5237a145..c14209e6ed 100644 --- a/toolkit/devtools/server/actors/inspector.js +++ b/toolkit/devtools/server/actors/inspector.js @@ -584,6 +584,16 @@ var NodeActor = exports.NodeActor = protocol.ActorClass({ } }), + /** + * Scroll the selected node into view. + */ + scrollIntoView: method(function() { + this.rawNode.scrollIntoView(true); + }, { + request: {}, + response: {} + }), + /** * Get the node's image data if any (for canvas and img nodes). * Returns an imageData object with the actual data being a LongStringActor @@ -1438,6 +1448,8 @@ var WalkerActor = protocol.ActorClass({ * Named options, including: * `sameDocument`: If true, parents will be restricted to the same * document as the node. + * `sameTypeRootTreeItem`: If true, this will not traverse across + * different types of docshells. */ parents: method(function(node, options={}) { if (isNodeDead(node)) { @@ -1448,16 +1460,23 @@ var WalkerActor = protocol.ActorClass({ let parents = []; let cur; while((cur = walker.parentNode())) { - if (options.sameDocument && cur.ownerDocument != node.rawNode.ownerDocument) { + if (options.sameDocument && nodeDocument(cur) != nodeDocument(node.rawNode)) { break; } + + if (options.sameTypeRootTreeItem && + nodeDocshell(cur).sameTypeRootTreeItem != nodeDocshell(node.rawNode).sameTypeRootTreeItem) { + break; + } + parents.push(this._ref(cur)); } return parents; }, { request: { node: Arg(0, "domnode"), - sameDocument: Option(1) + sameDocument: Option(1), + sameTypeRootTreeItem: Option(1) }, response: { nodes: RetVal("array:domnode") @@ -3205,7 +3224,7 @@ var WalkerFront = exports.WalkerFront = protocol.FrontClass(WalkerActor, { let nodeType = types.getType("domnode"); let returnNode = nodeType.read(nodeType.write(nodeActor, walkerActor), this); let top = returnNode; - let extras = walkerActor.parents(nodeActor); + let extras = walkerActor.parents(nodeActor, {sameTypeRootTreeItem: true}); for (let extraActor of extras) { top = nodeType.read(nodeType.write(extraActor, walkerActor), this); } @@ -3453,6 +3472,30 @@ var InspectorActor = exports.InspectorActor = protocol.ActorClass({ }, { request: {url: Arg(0), maxDim: Arg(1, "nullable:number")}, response: RetVal("imageData") + }), + + /** + * Resolve a URL to its absolute form, in the scope of a given content window. + * @param {String} url. + * @param {NodeActor} node If provided, the owner window of this node will be + * used to resolve the URL. Otherwise, the top-level content window will be + * used instead. + * @return {String} url. + */ + resolveRelativeURL: method(function(url, node) { + let document = isNodeDead(node) + ? this.window.document + : nodeDocument(node.rawNode); + + if (!document) { + return url; + } else { + let baseURI = Services.io.newURI(document.location.href, null, null); + return Services.io.newURI(url, null, baseURI).spec; + } + }, { + request: {url: Arg(0, "string"), node: Arg(1, "nullable:domnode")}, + response: {value: RetVal("string")} }) }); @@ -3510,6 +3553,16 @@ function nodeDocument(node) { return node.ownerDocument || (node.nodeType == Ci.nsIDOMNode.DOCUMENT_NODE ? node : null); } +function nodeDocshell(node) { + let doc = node ? nodeDocument(node) : null; + let win = doc ? doc.defaultView : null; + if (win) { + return win. + QueryInterface(Ci.nsIInterfaceRequestor). + getInterface(Ci.nsIDocShell); + } +} + function isNodeDead(node) { return !node || !node.rawNode || Cu.isDeadWrapper(node.rawNode); } diff --git a/toolkit/devtools/server/actors/styles.js b/toolkit/devtools/server/actors/styles.js index 7cf7d2c3fb..8c05a41659 100644 --- a/toolkit/devtools/server/actors/styles.js +++ b/toolkit/devtools/server/actors/styles.js @@ -1017,7 +1017,8 @@ var StyleRuleActor = protocol.ActorClass({ // Elements don't have a parent stylesheet, and therefore // don't have an associated URI. Provide a URI for // those. - form.href = this.rawNode.ownerDocument.location.href; + let doc = this.rawNode.ownerDocument; + form.href = doc.location ? doc.location.href : ""; form.cssText = this.rawStyle.cssText || ""; break; case Ci.nsIDOMCSSRule.CHARSET_RULE: @@ -1240,7 +1241,7 @@ var StyleRuleFront = protocol.FrontClass(StyleRuleActor, { return this._form.href; } let sheet = this.parentStyleSheet; - return sheet.href; + return sheet ? sheet.href : ""; }, get nodeHref() { diff --git a/toolkit/devtools/server/tests/mochitest/chrome.ini b/toolkit/devtools/server/tests/mochitest/chrome.ini index 89bb6330e0..76a778da0e 100644 --- a/toolkit/devtools/server/tests/mochitest/chrome.ini +++ b/toolkit/devtools/server/tests/mochitest/chrome.ini @@ -63,7 +63,9 @@ skip-if = buildapp == 'mulet' [test_inspector-release.html] [test_inspector-reload.html] [test_inspector-remove.html] +[test_inspector-resolve-url.html] [test_inspector-retain.html] +[test_inspector-scroll-into-view.html] [test_inspector-traversal.html] [test_makeGlobalObjectReference.html] [test_memory.html] diff --git a/toolkit/devtools/server/tests/mochitest/inspector-traversal-data.html b/toolkit/devtools/server/tests/mochitest/inspector-traversal-data.html index 70f2fac2eb..7c346fc4d0 100644 --- a/toolkit/devtools/server/tests/mochitest/inspector-traversal-data.html +++ b/toolkit/devtools/server/tests/mochitest/inspector-traversal-data.html @@ -86,5 +86,6 @@
+
scroll
diff --git a/toolkit/devtools/server/tests/mochitest/test_inspector-resolve-url.html b/toolkit/devtools/server/tests/mochitest/test_inspector-resolve-url.html new file mode 100644 index 0000000000..d8de297073 --- /dev/null +++ b/toolkit/devtools/server/tests/mochitest/test_inspector-resolve-url.html @@ -0,0 +1,90 @@ + + + + + + Test for Bug 921102 + + + + + + + +Mozilla Bug 921102 +Test Document +

+ +
+
+ + diff --git a/toolkit/devtools/server/tests/mochitest/test_inspector-scroll-into-view.html b/toolkit/devtools/server/tests/mochitest/test_inspector-scroll-into-view.html new file mode 100644 index 0000000000..dc534123b1 --- /dev/null +++ b/toolkit/devtools/server/tests/mochitest/test_inspector-scroll-into-view.html @@ -0,0 +1,90 @@ + + + + + + Test for Bug 901250 + + + + + + + +Mozilla Bug 901250 +Test Document +

+ +
+
+ + diff --git a/toolkit/devtools/shared/frame-script-utils.js b/toolkit/devtools/shared/frame-script-utils.js index 108a52945d..3859bd1191 100644 --- a/toolkit/devtools/shared/frame-script-utils.js +++ b/toolkit/devtools/shared/frame-script-utils.js @@ -3,11 +3,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const Cu = Components.utils; - +const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; const { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); devtools.lazyImporter(this, "promise", "resource://gre/modules/Promise.jsm", "Promise"); devtools.lazyImporter(this, "Task", "resource://gre/modules/Task.jsm", "Task"); +const loader = Cc["@mozilla.org/moz/jssubscript-loader;1"] + .getService(Ci.mozIJSSubScriptLoader); +let EventUtils = {}; +loader.loadSubScript("chrome://marionette/content/EventUtils.js", EventUtils); addMessageListener("devtools:test:history", function ({ data }) { content.history[data.direction](); @@ -133,6 +136,36 @@ addMessageListener("devtools:test:setStyle", function(msg) { sendAsyncMessage("devtools:test:setStyle"); }); +/** + * Get information about a DOM element, identified by a selector. + * @param {Object} data + * - {String} selector The CSS selector to get the node (can be a "super" + * selector). + * @return {Object} data Null if selector didn't match any node, otherwise: + * - {String} tagName. + * - {String} namespaceURI. + * - {Number} numChildren The number of children in the element. + * - {Array} attributes An array of {name, value, namespaceURI} objects. + */ +addMessageListener("devtools:test:getDomElementInfo", function(msg) { + let {selector} = msg.data; + let node = superQuerySelector(selector); + + let info = null; + if (node) { + info = { + tagName: node.tagName, + namespaceURI: node.namespaceURI, + numChildren: node.children.length, + attributes: [...node.attributes].map(({name, value, namespaceURI}) => { + return {name, value, namespaceURI}; + }) + }; + } + + sendAsyncMessage("devtools:test:getDomElementInfo", info); +}); + /** * Set a given attribute value on a node. * @param {Object} data @@ -153,6 +186,55 @@ addMessageListener("devtools:test:setAttribute", function(msg) { sendAsyncMessage("devtools:test:setAttribute"); }); +/** + * Synthesize a mouse event on an element. This handler doesn't send a message + * back. Consumers should listen to specific events on the inspector/highlighter + * to know when the event got synthesized. + * @param {Object} msg The msg.data part expects the following properties: + * - {Number} x + * - {Number} y + * - {Boolean} center If set to true, x/y will be ignored and + * synthesizeMouseAtCenter will be used instead + * - {Object} options Other event options + * - {String} selector An optional selector that will be used to find the node to + * synthesize the event on, if msg.objects doesn't contain the CPOW. + * The msg.objects part should be the element. + * @param {Object} data Event detail properties: + */ +addMessageListener("Test:SynthesizeMouse", function(msg) { + let {x, y, center, options, selector} = msg.data; + let {node} = msg.objects; + + if (!node && selector) { + node = superQuerySelector(selector); + } + + if (center) { + EventUtils.synthesizeMouseAtCenter(node, options, node.ownerDocument.defaultView); + } else { + EventUtils.synthesizeMouse(node, x, y, options, node.ownerDocument.defaultView); + } + + // Most consumers won't need to listen to this message, unless they want to + // wait for the mouse event to be synthesized and don't have another event + // to listen to instead. + sendAsyncMessage("Test:SynthesizeMouse"); +}); + +/** + * Synthesize a key event for an element. This handler doesn't send a message + * back. Consumers should listen to specific events on the inspector/highlighter + * to know when the event got synthesized. + * @param {Object} msg The msg.data part expects the following properties: + * - {String} key + * - {Object} options + */ +addMessageListener("Test:SynthesizeKey", function(msg) { + let {key, options} = msg.data; + + EventUtils.synthesizeKey(key, options, content); +}); + /** * Like document.querySelector but can go into iframes too. * ".container iframe || .sub-container div" will first try to find the node diff --git a/toolkit/devtools/shared/moz.build b/toolkit/devtools/shared/moz.build index 0d283a2d34..4530c2da96 100644 --- a/toolkit/devtools/shared/moz.build +++ b/toolkit/devtools/shared/moz.build @@ -58,11 +58,11 @@ if CONFIG['MOZ_DEVTOOLS']: EXTRA_JS_MODULES.devtools.shared += [ 'autocomplete-popup.js', - 'd3.js', 'devices.js', 'doorhanger.js', 'frame-script-utils.js', 'inplace-editor.js', + 'node-attribute-parser.js', 'observable-object.js', 'options-view.js', 'source-utils.js', diff --git a/toolkit/devtools/shared/node-attribute-parser.js b/toolkit/devtools/shared/node-attribute-parser.js new file mode 100644 index 0000000000..94f5fe0115 --- /dev/null +++ b/toolkit/devtools/shared/node-attribute-parser.js @@ -0,0 +1,278 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +/** + * This module contains a small element attribute value parser. It's primary + * goal is to extract link information from attribute values (like the href in + * for example). + * + * There are several types of linkable attribute values: + * - TYPE_URI: a URI (e.g. ). + * - TYPE_URI_LIST: a space separated list of URIs (e.g. ). + * - TYPE_IDREF: a reference to an other element in the same document via its id + * (e.g.