mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1261720 (part 1) - Separate js::ClassExtension from js::Class. r=jorendorff,bz. (6368952442)
- Bug 1261720 (part 2) - Move ClassExtension::isWrappedNative into js::Class::flags. r=jorendorff. (554fe695c2)
- Bug 1261723 (part 1) - Rename js::Class::ops as oOps. r=efaust. (e9dace574c)
- Bug 1261723 (part 2) - Separate class ops from js::Class. code=njn,h4writer. r=efaust,bz. (54bc06aec6)
- Bug 1263865 - Check the return value of GetSelfHostedFunction in ArraySpeciesCreate. r=efaust (cc6e1c0e50)
- Bug 1248948 - Don't pass non-SavedFrame objects to SavedFrame JSAPI functions; r=tromey r=evilpie (8c753c3c89)
- Bug 1260475 - Add an option to disable GC slices triggered by painting. r=terrence a=kwierso (df86be5e34)
- Bug 1263803 - Change AllocateArrayBuffer to receive byteLength instead of nelements. r=lth (751e333ff0)
- Bug 1264941 - Use byteLength of source typedArray in CloneArrayBuffer. r=lth (0095fce3aa)
- Bug 1263879 - Check the return value of AtomizeString in str_replace_string_raw. r=h4writer (31e1470bc3)
- Bug 1258453 - Compact arenas containing strings r=terrence (f6b4029d79)
- Bug 1258095 - patch 1/3 - OSFileSystem should have the root == the directory root, r=smaug (8cf74899f4)
- Bug 1258095 - patch 2/3 - Implement Directory::GetPath() correctly, r=smaug (776f503c98)
- Bug 1258095 - patch 3/3 - Directory tasks should use FallibleArray, r=smaug (b4888c92b9)
- Bug 1258221 - patch 1 - File::CreateFromFile only for main-thread, r=smaug (c106b37cb4)
- Bug 1258056 - Propagate the window opener full page zoom across the IPC layer; r=smaug (511386589f)
- Bug 1248772 - Trigger a OS window focus in ServiceWorkerClients::OpenWindow. r=ehsan (feb322b9f0)
- Bug 1259707 - Fix confusion between desktop and CSS pixels when session-restore is constraining window to the available screen space. r=emk (def9cc918b)
- Bug 1250266 - Always send a TTL in the Push mochitests. r=benbangert (43c7bde7b8)
- Bug 1244816 - Create PushService mock for mochitests backed by a mock web socket. r=kitcambridge (92270cbae5)
- Bug 1257395: Update comments for GCHashTable and GCPolicy. DONTBUILD r=terrence (fee0311ea0)
- Bug 1263772 - Use WeakCache wrapper to sweep BaseShape table; r=jonco (a0e015667c)
- Bug 1263777 - Use WeakCache to sweep the InitialShapeTable; r=jonco (84d1591585)
- Bug 1132502 (part 1) - Abort if compartmentStats is null during memory reporting. r=jandem. (bd144192b1)
- Bug 1132502 (part 2) - Don't call AddClassInfo() for BaseShapes. r=jandem. (10881fe48c)
- Bug 1259490 - Update the DtoA cache after compacting GC; r=jandem (6e3139501c)
- Bug 1257903 - Fix spurious GC hazard on a CLOSED TREE r=me (ce2935d8b2)
- Bug 1259042 - Re-introduce a version of ZoneCellIter for use under GC r=terrence (d1e4ca6e30)
- Bug 1259180 - Compact arenas containing scripts r=terrence (365d22ab00)
- Bug 1258407 - Limit GC heap growth parameters r=sfink (1c9ffb0e3f)
- Bug 1263966 - Compact arenas containing lazy scripts r=terrence (e22c571c37)
- Bug 1266107 - Update type descriptors first when compacting r=terrence (4c2ca98bb3)
- Bug 1266105 - Only purge runtime tables once per slice when compacting r=terrence (74e2977241)
- Bug 1263769 - Sweep WeakCaches in parallel; r=sfink (54b077b37b)
- Bug 1266107 - Track all existing typed object descriptor objects r=terrence (bc60425bf6)
- Bug 1260198 - Clear per-zone string cache after compacting r=terrence (c3002b8021)
- Bug 1259306 - Trace ShapeTables r=terrence (15abb48a33)
- Bug 1262203 - Skip shape table tracing where possible r=terrence (8a1ec15053)
- Bug 1164432 - Update test_try_registering_offline_disabled.html to use mock push server. r=kitcambridge (6d52de1a17)
- Bug 1263857 - Initialize the slots of the match result object before creating properties in generateRegExpMatcherStub. r=h4writer (802af47b3a)
- Bug 1263549 - Fix inlined RegExpPrototypeOptimizable and RegExpInstanceOptimizable. r=h4writer (5565bca590)
- Bug 1264998 - CodeGeneratorShared::assignBailoutId: Properly handle allocation errors. r=h4writer (258cbfc0b6)
- Bug 1257408 - Fix VS2015 C4312 warnings in js/src. r=nbp (d52a4d1fe7)
- Bug 1220466 - Don't build event region display items for pseudo stacking contexts, unless they are also an AGR. r=mstange (9f9a2c7eba)
- Bug 1220466 - Avoid doing unnecessary layer building work for inactive layers. r=mstange (372097e6df)
- Bug 1239151. Increase skia font cache size to 10mb on non-android platforms. r=lsalzman (8a2029da40)
- Bug 1255068 - Do not allow empty transaction transform changes if the scroll position has changed since the last paint. r=kats, r=mattwoodrow (f4a42e10c8)
- Bug 1255068 - Add a check for null scrollid. r=kats (3ddbb78fd3)
- Bug 1258910 - IonMonkey: MIPS: Implement float-point conditional move instructions. r=huangwenjun06 (b53499103b)
- Bug 1258910 - OdinMonkey: MIPS64: Implement AsmSelectI64. r=bbouvier (a36cfffa1d)
- Bug 1258910 - OdinMonkey: MIPS: Implement AsmSelect. r=bbouvier (e458724bc1)
- Bug 1254500 - IonMonkey: MIPS: Implement ma_ctz. r=arai (c8bfd7a6c9)
- Bug 1254500 - IonMonkey: MIPS: Implement CodeGeneratorMIPSShared::visitCtzI. r=arai (b65dad7d1b)
- Bug 1254500 - IonMonkey: MIPS: Implement CodeGeneratorMIPSShared::visitPopcntI. r=arai (58c00b603e)
- Bug 1258105 - Port object length stubs to CacheIR. r=efaust (ed0ec07678)
- Bug 1258301 - Use TraceNullableEdge for CacheIR pointers. r=jonco (3342ef24b4)
- Bug 1258327 - Part 1: Move ToAddress from CodeGeneratorMIPSShared to CodeGeneratorShared. r=hev (59e7494f02)
- Bug 1258327 - Part 2: Remove Operand variant from bailoutCmp32. r=nbp (c4609af383)
- Bug 1258327 - Part 3: Remove Operand variant from branch32 except x86-shared. r=nbp (dca4bc7577)
- Bug 1258327 - Part 4: Remove ToOperand call from arm CodeGenerator. r=jandem (395d7a004f)
- Bug 1258327 - Part 5: Remove dummy ToOperand definition from arm64 CodeGenerator. r=jandem (bc447cb6aa)
- Bug 1258327 - Part 6: Remove ToOperand call from mips-shared and mips64 CodeGenerator. r=hev (d01b028148)
- Bug 1258327 - Part 7: Move ToOperand from CodeGeneratorShared to CodeGeneratorX86Shared. r=nbp (71449d7c62)
- Bug 1248412 - Prevent immediate bailout from innermost for-of loops. r=h4writer (616897a580)
- Bug 1261326 - Fix a bogus assert. r=bhackett (ff715a7954)
- Bug 1260371 - Rearrange RelocationOverlay so that magic field does not overlay inline string chars r=terrence (f88fbb8927)
- Bug 1262203 - Do GC relocation writes in order; r=sfink (b82a25dd15)
- Bug 1247909 - Move MFunctionEnvironment after the entry resume points operands. r=h4writer (29d8d1c2df)
- Bug 1259925 - Port ModuleNamespace getprop stub to CacheIR. r=efaust (b31980bdc3)
- Bug 1264561 - Fix ClassOps::call and ClassOps::construct address calculation in visitIsCallable and visitIsConstructor. r=efaust (172037857b)
- Bug 1264823 - Add pre-barrier to the elements of mapIterationResultPair. r=jandem (b2e451c371)
- Bug 1263609: SharedStubs - Allow JSOP_POW in ion codegen ON CLOSED TREE, r=bbouvier (16bb4ca9af)
- Bug 1265159 - IonMonkey: Throw error when popping from an empty array in MArrayPopShift, r=jandem (e3a1b08614)
- Bug 1259392 - nail down isLockFree(4) for good. r=jolesen (72fa558eec)
- Bug 1244252 - Don't check object group generation when generating code to create unboxed objects off thread, r=terrence. (4191175759)
- Bug 1254578 - Fix OOM case when rematerializing frames. (r=jandem) (a213756a2b)
- Bug 1263139 - Apply ToString to non-standard flags argument of String.prototype.{match,search,replace}. r=till (91c8f6f592)
- Bug 1257810 - ReleaseAcquire should be adequate for a counter; r=sfink (e394a21b3d)
- Bug 1251833 - Part 4: Remove some unneeded qualification from GCRuntime and friends. r=terrence (e77de1a3ac)
- Bug 1260371 - Forward another pointer during TypedObject tracing to fix bustage r=me (24636e9463)
- Bug 1266107 - Simplify typed object tracing now type descriptors are traced first r=terrence (6872be4bfa)
- Bug 1260998 - Add support for HOST_CPPFLAGS for consistency. r=nalexander (9fe0ddee7e)
- Bug 1105556 - Don't call CheckLoadURIWithPrincipal() in DoCheckLoadURIChecks() for TYPE_DOCUMENT loads where we don't have a loadingPrincipal. Ensure SEC_COOKIES_SAME_ORIGIN isn't set for TYPE_DOCUMENT loads in CheckChannel(). r=ckerschb, sicking (fbebbf1017)
- Bug 1195172 - Use channel->ascynOpen2 layout/style/FontFaceSet.cpp (r=bz,cam) (3e943da95c)
- Bug 1250986 - Make Request.referrer a USVString; r=bzbarsky (6987ab9838)
- Bug 1250987 - Make RequestInit.body nullable; r=bzbarsky (2496ebea1f)
- Bug 1251448 - Add support for RequestInit.referrer; r=jdm (dcf1a668f8)
- Bug 1250985 - Part 1: Add a way to identify whether a WebIDL dictionary has any members present; r=bzbarsky (7ddd6e8043)
- Bug 1250985 - Part 2: Prevent copy constructing a Request object with navigate mode if a RequestInit member is present; r=bzbarsky (24c8c1ca56)
- Bug 1184550 - Move the check for bodyUsed before the check for a null body so subsequent fetches with the same Request fail. r=bkelly (60837c04eb)
- Bug 1251872 - Part 1: Implement Request.referrerPolicy; r=jdm (bd024c0614)
- bug 1252687 - make Migration's ctor constexpr r=bz (793d608bcd)
- Bug 1251872 - Part 2: Store the Request referrerPolicy in the DOM Cache; r=bkelly (e1511c07a6)
- Bug 1251229 P2 Add wpt test verifying FetchEvent.request.url does not include fragments. r=ehsan (1d74e2491e)
- Bug 1251229 P1 Strip fragment from request URL when creating FetchEvent. r=ehsan (5faddecc78)
- Bug 1120715 - Part 4: Add tests for Request.cache; r=bkelly (81537bd125)
- Bug 1237455 P1 Make file_CrossSiteXHR_server.sjs check headers on redirects. r=ehsan (597fdf223d)
- Bug 1237455 P2 Test headers on redirects in fetch mochitests. r=ehsan (2a19ac6a44)
- Bug 1237455 P3 Add a version of test_fetch_cors that reroutes through an empty service worker. r=ehsan (0550d5e115)
- Bug 1205288 - implement and test fetch spec changes for blob scheme with non-GET method. r=bkelly (bb519b1c71)
- Bug 1237455 P4 Create helper method to set fetch request headers. r=ehsan (20266aa708)
- Bug 1237455 P5 Set headers on fetch() redirects. r=ehsan (95dcfe7f71)
- Bug 1120715 - Part 5: Treat a default cache mode Request with a revalidation header as no-store; r=bkelly (4182fded21)
- fix! (c3097a682a)
- Bug 1204520 - Remove unused return value from FetchDriver::FailWithNetworkError. r=jdm (ddd84df514)
- Bug 1253054 - Stop warning if request has already failed. r=bkelly (52eb17afd2)
- Bug 1176824 - Intermittent browser_test_web_manifest.js. r=ckerschb (b8c1fc5757)
- Bug 1242051 - Add inter-directory test support file dependencies to ini manifests. r=gps (5d06d6b00c)
- Bug 1250048 - CSP manifest-src doesn't override default-src. r=ckerschb,bkelly,ehsan (3d77b91226)
- Bug 1262624 Move service worker wpt tests out of mozilla dir so they will be upstreamed. r=jgraham (cf1f010cd2)
- Bug 1263469 P1 Set FetchEvent.request.cache value correctly for non-fetch channels. r=mayhemer (0fac232769)
- Bug 1263469 P2 Validate FetchEvent.request.cache in refresh mochitest. r=ehsan (de0db7da84)
- Bug 1263469 P3 Test FetchEvent.request.cache value on reload in wpt test. r=ehsan (8b4fc58d08)
- Bug 1263469 P4 Update test_eventsource_intercept.html to validate FetchEvent.request.cache. r=ehsan (81843666c0)
- Bug 1263469 P5 Add a wpt test case for EventSource. r=ehsan (a32cbbaf80)
- Bug 1265941 - Rename the ReferrerPolicy "origin-only" enum value to "origin"; r=jdm (1b1dfcebbc)
This commit is contained in:
@@ -6,25 +6,8 @@ support-files =
|
||||
letters.gif
|
||||
moz.png
|
||||
longdesc_src.html
|
||||
actions.js
|
||||
attributes.js
|
||||
autocomplete.js
|
||||
browser.js
|
||||
common.js
|
||||
events.js
|
||||
grid.js
|
||||
layout.js
|
||||
name.js
|
||||
pivot.js
|
||||
relations.js
|
||||
role.js
|
||||
selectable.js
|
||||
states.js
|
||||
table.js
|
||||
value.js
|
||||
text.js
|
||||
*.js
|
||||
treeview.css
|
||||
treeview.js
|
||||
|
||||
[test_aria_token_attrs.html]
|
||||
[test_bug420863.html]
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/dom/media/test/bug461281.ogg
|
||||
|
||||
[test_anchors.html]
|
||||
[test_aria.html]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_obj.html]
|
||||
[test_obj_css.html]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_list.html]
|
||||
[test_select.html]
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files = editabletext.js
|
||||
support-files =
|
||||
editabletext.js
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_1.html]
|
||||
[test_2.html]
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/moz.png
|
||||
!/dom/media/test/bug461281.ogg
|
||||
|
||||
[test_HTMLSpec.html]
|
||||
skip-if = buildapp == 'mulet'
|
||||
|
||||
@@ -3,6 +3,8 @@ support-files =
|
||||
docload_wnd.html
|
||||
focus.html
|
||||
scroll.html
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/letters.gif
|
||||
|
||||
[test_aria_alert.html]
|
||||
[test_aria_menu.html]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_focusedChild.html]
|
||||
skip-if = (os == 'win' && (os_version == '6.2' || os_version == '6.3')) # bug 845134
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files = zoom_tree.xul
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/letters.gif
|
||||
|
||||
[test_browser.html]
|
||||
[test_canvas_hitregion.html]
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files = hyperlink.js
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/letters.gif
|
||||
|
||||
[test_general.html]
|
||||
[test_general.xul]
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/letters.gif
|
||||
|
||||
[test_general.html]
|
||||
[test_update.html]
|
||||
|
||||
@@ -7,6 +7,8 @@ support-files =
|
||||
doc_traversal.html
|
||||
doc_content_integration.html
|
||||
doc_content_text.html
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/moz.png
|
||||
|
||||
[test_alive.html]
|
||||
[test_content_integration.html]
|
||||
|
||||
@@ -4,6 +4,8 @@ support-files =
|
||||
general.xbl
|
||||
markup.js
|
||||
markuprules.xml
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/moz.png
|
||||
|
||||
[test_browserui.xul]
|
||||
[test_counterstyle.html]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
support-files =
|
||||
doc_virtualcursor.html
|
||||
doc_virtualcursor_text.html
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_virtualcursor.html]
|
||||
[test_virtualcursor_text.html]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_bindings.xhtml]
|
||||
[test_embeds.xul]
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/moz.png
|
||||
|
||||
[test_aria.html]
|
||||
[test_aria.xul]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_zoom.html]
|
||||
[test_zoom_text.html]
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/treeview.css
|
||||
!/accessible/tests/mochitest/treeview.js
|
||||
|
||||
[test_aria.html]
|
||||
[test_listbox.xul]
|
||||
|
||||
@@ -5,6 +5,10 @@ support-files =
|
||||
z_frames_checkbox.html
|
||||
z_frames_textbox.html
|
||||
z_frames_update.html
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/dumbfile.xpi
|
||||
!/accessible/tests/mochitest/formimage.png
|
||||
!/accessible/tests/mochitest/treeview.css
|
||||
|
||||
[test_aria.html]
|
||||
[test_aria.xul]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_css_tables.html]
|
||||
[test_headers_ariagrid.html]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files = doc.html
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_atcaretoffset.html]
|
||||
[test_charboundary.html]
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/moz.png
|
||||
|
||||
[test_general.html]
|
||||
[test_invalid.html]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_browserui.xul]
|
||||
[test_general.html]
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/moz.png
|
||||
|
||||
[test_general.html]
|
||||
[test_selection.html]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_general.html]
|
||||
[test_userinput.html]
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
support-files =
|
||||
dockids.html
|
||||
wnd.xul
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/formimage.png
|
||||
!/accessible/tests/mochitest/letters.gif
|
||||
!/accessible/tests/mochitest/moz.png
|
||||
!/accessible/tests/mochitest/tree/wnd.xul
|
||||
!/dom/media/test/bug461281.ogg
|
||||
|
||||
[test_applicationacc.xul]
|
||||
skip-if = true # Bug 561508
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
!/accessible/tests/mochitest/letters.gif
|
||||
!/accessible/tests/mochitest/moz.png
|
||||
|
||||
[test_ariadialog.html]
|
||||
[test_ariaowns.html]
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
!/accessible/tests/mochitest/*.js
|
||||
|
||||
[test_general.html]
|
||||
[test_number.html]
|
||||
|
||||
@@ -159,8 +159,12 @@ endif
|
||||
endif
|
||||
|
||||
|
||||
# Builds using the hybrid FasterMake/RecursiveMake backend will
|
||||
# fail to produce a langpack. See bug 1255096.
|
||||
libs::
|
||||
ifeq (,$(filter FasterMake+RecursiveMake,$(BUILD_BACKENDS)))
|
||||
$(MAKE) -C $(DEPTH)/browser/locales langpack
|
||||
endif
|
||||
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
PKGCOMP_FIND_OPTS =
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Setup for build cache
|
||||
|
||||
# Avoid duplication if the file happens to be included twice.
|
||||
if test -z "$bucket"; then
|
||||
if test -z "$bucket" -a -z "$NO_CACHE"; then
|
||||
|
||||
read branch platform master <<EOF
|
||||
$(python2.7 -c 'import json; p = json.loads(open("'"$topsrcdir"'/../buildprops.json").read())["properties"]; print p["branch"], p["platform"], p["master"]' 2> /dev/null)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
skip-if = buildapp == 'b2g' || os == 'android'
|
||||
support-files =
|
||||
file_disableScript.html
|
||||
!/caps/tests/mochitest/file_disableScript.html
|
||||
|
||||
[test_bug995943.xul]
|
||||
[test_addonMayLoad.html]
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
support-files =
|
||||
file_data.txt
|
||||
file_disableScript.html
|
||||
!/js/xpconnect/tests/mochitest/file_empty.html
|
||||
|
||||
[test_app_principal_equality.html]
|
||||
[test_bug246699.html]
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
head =
|
||||
tail =
|
||||
skip-if = toolkit == 'android' || toolkit == 'gonk'
|
||||
support-files =
|
||||
!/chrome/test/unit/data/**
|
||||
!/chrome/test/unit/test_resolve_uris.js
|
||||
!/chrome/test/unit/head_crtestutils.js
|
||||
|
||||
[test_resolve_uris_ipc.js]
|
||||
|
||||
+4
-4
@@ -897,19 +897,19 @@ $(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
|
||||
# Rules for building native targets must come first because of the host_ prefix
|
||||
$(HOST_COBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
|
||||
$(HOST_CPPOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
|
||||
$(HOST_CMOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
|
||||
$(HOST_CMMOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
|
||||
$(COBJS):
|
||||
$(REPORT_BUILD)
|
||||
|
||||
+3
-14
@@ -2051,13 +2051,7 @@ ia64*-hpux*)
|
||||
;;
|
||||
|
||||
*-*linux*)
|
||||
# Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
|
||||
# Similarly for GNU_CXX and INTEL_CXX.
|
||||
if test "$INTEL_CC" -o "$INTEL_CXX"; then
|
||||
# -Os has been broken on Intel's C/C++ compilers for quite a
|
||||
# while; Intel recommends against using it.
|
||||
MOZ_OPTIMIZE_FLAGS="-O2"
|
||||
elif test "$GNU_CC" -o "$GNU_CXX"; then
|
||||
if test "$GNU_CC" -o "$GNU_CXX"; then
|
||||
MOZ_PGO_OPTIMIZE_FLAGS="-O3"
|
||||
MOZ_OPTIMIZE_FLAGS="-O2"
|
||||
if test -z "$CLANG_CC"; then
|
||||
@@ -7607,13 +7601,6 @@ fi
|
||||
|
||||
CFLAGS="$_SAVE_CFLAGS"
|
||||
|
||||
if test -n "$INTEL_CC"; then
|
||||
PROFILE_GEN_CFLAGS="-prof-gen -prof-dir ."
|
||||
PROFILE_GEN_LDFLAGS=
|
||||
PROFILE_USE_CFLAGS="-prof-use -prof-dir ."
|
||||
PROFILE_USE_LDFLAGS=
|
||||
fi
|
||||
|
||||
dnl Sun Studio on Solaris
|
||||
if test "$SOLARIS_SUNPRO_CC"; then
|
||||
PROFILE_GEN_CFLAGS="-xprofile=collect:$_objdir/$enable_application"
|
||||
@@ -8568,6 +8555,7 @@ AC_SUBST(WCHAR_CFLAGS)
|
||||
AC_SUBST(HOST_CC)
|
||||
AC_SUBST(HOST_CXX)
|
||||
AC_SUBST(HOST_CFLAGS)
|
||||
AC_SUBST(HOST_CPPFLAGS)
|
||||
AC_SUBST(HOST_CXXFLAGS)
|
||||
AC_SUBST(HOST_LDFLAGS)
|
||||
AC_SUBST(HOST_OPTIMIZE_FLAGS)
|
||||
@@ -9016,6 +9004,7 @@ export LDFLAGS
|
||||
export HOST_CC
|
||||
export HOST_CXX
|
||||
export HOST_CFLAGS
|
||||
export HOST_CPPFLAGS
|
||||
export HOST_CXXFLAGS
|
||||
export HOST_LDFLAGS
|
||||
|
||||
|
||||
@@ -62,7 +62,8 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if (!JS::CopyAsyncStack(aCx, asyncStack, asyncCause, &parentFrame, 0)) {
|
||||
if (JS::IsSavedFrame(asyncStack) &&
|
||||
!JS::CopyAsyncStack(aCx, asyncStack, asyncCause, &parentFrame, 0)) {
|
||||
JS_ClearPendingException(aCx);
|
||||
} else {
|
||||
stackFrame.mAsyncParent = parentFrame;
|
||||
|
||||
@@ -3,6 +3,8 @@ support-files =
|
||||
testcommon.js
|
||||
../../imptests/testharness.js
|
||||
../../imptests/testharnessreport.js
|
||||
!/dom/animation/test/chrome/file_animate_xrays.html
|
||||
|
||||
[chrome/test_animate_xrays.html]
|
||||
# file_animate_xrays.html needs to go in mochitest.ini since it is served
|
||||
# over HTTP
|
||||
|
||||
@@ -2,83 +2,85 @@
|
||||
# Support files for chrome tests that we want to load over HTTP need
|
||||
# to go in here, not chrome.ini.
|
||||
support-files =
|
||||
testcommon.js
|
||||
chrome/file_animate_xrays.html
|
||||
css-animations/file_animation-cancel.html
|
||||
css-animations/file_animation-computed-timing.html
|
||||
css-animations/file_animation-currenttime.html
|
||||
css-animations/file_animation-finish.html
|
||||
css-animations/file_animation-finished.html
|
||||
css-animations/file_animation-id.html
|
||||
css-animations/file_animation-oncancel.html
|
||||
css-animations/file_animation-onfinish.html
|
||||
css-animations/file_animation-pausing.html
|
||||
css-animations/file_animation-play.html
|
||||
css-animations/file_animation-playstate.html
|
||||
css-animations/file_animation-ready.html
|
||||
css-animations/file_animation-reverse.html
|
||||
css-animations/file_animation-starttime.html
|
||||
css-animations/file_animations-dynamic-changes.html
|
||||
css-animations/file_cssanimation-animationname.html
|
||||
css-animations/file_document-get-animations.html
|
||||
css-animations/file_effect-target.html
|
||||
css-animations/file_element-get-animations.html
|
||||
css-animations/file_keyframeeffect-getframes.html
|
||||
css-animations/file_pseudoElement-get-animations.html
|
||||
css-transitions/file_animation-cancel.html
|
||||
css-transitions/file_animation-computed-timing.html
|
||||
css-transitions/file_animation-currenttime.html
|
||||
css-transitions/file_animation-finished.html
|
||||
css-transitions/file_animation-pausing.html
|
||||
css-transitions/file_animation-ready.html
|
||||
css-transitions/file_animation-starttime.html
|
||||
css-transitions/file_csstransition-transitionproperty.html
|
||||
css-transitions/file_document-get-animations.html
|
||||
css-transitions/file_effect-target.html
|
||||
css-transitions/file_element-get-animations.html
|
||||
css-transitions/file_keyframeeffect-getframes.html
|
||||
css-transitions/file_pseudoElement-get-animations.html
|
||||
document-timeline/file_document-timeline.html
|
||||
mozilla/file_deferred_start.html
|
||||
mozilla/file_hide_and_show.html
|
||||
mozilla/file_partial_keyframes.html
|
||||
testcommon.js
|
||||
|
||||
[css-animations/test_animations-dynamic-changes.html]
|
||||
support-files = css-animations/file_animations-dynamic-changes.html
|
||||
[css-animations/test_animation-cancel.html]
|
||||
support-files = css-animations/file_animation-cancel.html
|
||||
[css-animations/test_animation-computed-timing.html]
|
||||
support-files = css-animations/file_animation-computed-timing.html
|
||||
[css-animations/test_animation-currenttime.html]
|
||||
support-files = css-animations/file_animation-currenttime.html
|
||||
[css-animations/test_animation-finish.html]
|
||||
support-files = css-animations/file_animation-finish.html
|
||||
[css-animations/test_animation-finished.html]
|
||||
support-files = css-animations/file_animation-finished.html
|
||||
[css-animations/test_animation-id.html]
|
||||
support-files = css-animations/file_animation-id.html
|
||||
[css-animations/test_animation-oncancel.html]
|
||||
support-files = css-animations/file_animation-oncancel.html
|
||||
[css-animations/test_animation-onfinish.html]
|
||||
support-files = css-animations/file_animation-onfinish.html
|
||||
[css-animations/test_animation-pausing.html]
|
||||
support-files = css-animations/file_animation-pausing.html
|
||||
[css-animations/test_animation-play.html]
|
||||
support-files = css-animations/file_animation-play.html
|
||||
[css-animations/test_animation-playstate.html]
|
||||
support-files = css-animations/file_animation-playstate.html
|
||||
[css-animations/test_animation-ready.html]
|
||||
support-files = css-animations/file_animation-ready.html
|
||||
[css-animations/test_animation-reverse.html]
|
||||
support-files = css-animations/file_animation-reverse.html
|
||||
[css-animations/test_animation-starttime.html]
|
||||
support-files = css-animations/file_animation-starttime.html
|
||||
[css-animations/test_cssanimation-animationname.html]
|
||||
support-files = css-animations/file_cssanimation-animationname.html
|
||||
[css-animations/test_document-get-animations.html]
|
||||
support-files = css-animations/file_document-get-animations.html
|
||||
[css-animations/test_effect-target.html]
|
||||
support-files = css-animations/file_effect-target.html
|
||||
[css-animations/test_element-get-animations.html]
|
||||
skip-if = buildapp == 'mulet'
|
||||
support-files = css-animations/file_element-get-animations.html
|
||||
[css-animations/test_keyframeeffect-getframes.html]
|
||||
support-files = css-animations/file_keyframeeffect-getframes.html
|
||||
[css-transitions/test_animation-cancel.html]
|
||||
support-files = css-transitions/file_animation-cancel.html
|
||||
[css-transitions/test_animation-computed-timing.html]
|
||||
support-files = css-transitions/file_animation-computed-timing.html
|
||||
[css-transitions/test_animation-currenttime.html]
|
||||
support-files = css-transitions/file_animation-currenttime.html
|
||||
[css-transitions/test_animation-finished.html]
|
||||
support-files = css-transitions/file_animation-finished.html
|
||||
[css-transitions/test_animation-pausing.html]
|
||||
support-files = css-transitions/file_animation-pausing.html
|
||||
[css-transitions/test_animation-ready.html]
|
||||
support-files = css-transitions/file_animation-ready.html
|
||||
[css-transitions/test_animation-starttime.html]
|
||||
support-files = css-transitions/file_animation-starttime.html
|
||||
[css-transitions/test_csstransition-transitionproperty.html]
|
||||
support-files = css-transitions/file_csstransition-transitionproperty.html
|
||||
[css-transitions/test_document-get-animations.html]
|
||||
support-files = css-transitions/file_document-get-animations.html
|
||||
[css-transitions/test_effect-target.html]
|
||||
support-files = css-transitions/file_effect-target.html
|
||||
[css-transitions/test_element-get-animations.html]
|
||||
skip-if = buildapp == 'mulet'
|
||||
support-files = css-transitions/file_element-get-animations.html
|
||||
[css-transitions/test_keyframeeffect-getframes.html]
|
||||
support-files = css-transitions/file_keyframeeffect-getframes.html
|
||||
[document-timeline/test_document-timeline.html]
|
||||
support-files = document-timeline/file_document-timeline.html
|
||||
[document-timeline/test_request_animation_frame.html]
|
||||
skip-if = buildapp == 'mulet'
|
||||
[mozilla/test_deferred_start.html]
|
||||
support-files = mozilla/file_deferred_start.html
|
||||
skip-if = (toolkit == 'gonk' && debug)
|
||||
[mozilla/test_hide_and_show.html]
|
||||
support-files = mozilla/file_hide_and_show.html
|
||||
[mozilla/test_partial_keyframes.html]
|
||||
support-files = mozilla/file_partial_keyframes.html
|
||||
|
||||
@@ -3837,6 +3837,22 @@ nsContentUtils::DispatchChromeEvent(nsIDocument *aDoc,
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
nsContentUtils::DispatchFocusChromeEvent(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
MOZ_ASSERT(aWindow);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
|
||||
if (!doc) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return DispatchChromeEvent(doc, aWindow,
|
||||
NS_LITERAL_STRING("DOMServiceWorkerFocusClient"),
|
||||
true, true);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentUtils::DispatchEventOnlyToChrome(nsIDocument* aDoc,
|
||||
nsISupports* aTarget,
|
||||
@@ -8175,7 +8191,8 @@ nsContentUtils::IsPreloadType(nsContentPolicyType aType)
|
||||
nsresult
|
||||
nsContentUtils::SetFetchReferrerURIWithPolicy(nsIPrincipal* aPrincipal,
|
||||
nsIDocument* aDoc,
|
||||
nsIHttpChannel* aChannel)
|
||||
nsIHttpChannel* aChannel,
|
||||
mozilla::net::ReferrerPolicy aReferrerPolicy)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPrincipal);
|
||||
NS_ENSURE_ARG_POINTER(aChannel);
|
||||
@@ -8189,7 +8206,7 @@ nsContentUtils::SetFetchReferrerURIWithPolicy(nsIPrincipal* aPrincipal,
|
||||
aPrincipal->GetURI(getter_AddRefs(principalURI));
|
||||
|
||||
if (!aDoc) {
|
||||
return aChannel->SetReferrerWithPolicy(principalURI, net::RP_Default);
|
||||
return aChannel->SetReferrerWithPolicy(principalURI, aReferrerPolicy);
|
||||
}
|
||||
|
||||
// If it weren't for history.push/replaceState, we could just use the
|
||||
@@ -8218,7 +8235,10 @@ nsContentUtils::SetFetchReferrerURIWithPolicy(nsIPrincipal* aPrincipal,
|
||||
referrerURI = principalURI;
|
||||
}
|
||||
|
||||
net::ReferrerPolicy referrerPolicy = aDoc->GetReferrerPolicy();
|
||||
net::ReferrerPolicy referrerPolicy = aReferrerPolicy;
|
||||
if (referrerPolicy == net::RP_Default) {
|
||||
referrerPolicy = aDoc->GetReferrerPolicy();
|
||||
}
|
||||
return aChannel->SetReferrerWithPolicy(referrerURI, referrerPolicy);
|
||||
}
|
||||
|
||||
|
||||
@@ -1107,6 +1107,13 @@ public:
|
||||
bool aCancelable,
|
||||
bool *aDefaultAction = nullptr);
|
||||
|
||||
/**
|
||||
* Helper function for dispatching a "DOMServiceWorkerFocusClient" event to
|
||||
* the chrome event handler of the given DOM Window. This has the effect
|
||||
* of focusing the corresponding tab and bringing the browser window
|
||||
* to the foreground.
|
||||
*/
|
||||
static nsresult DispatchFocusChromeEvent(nsPIDOMWindow* aWindow);
|
||||
|
||||
/**
|
||||
* This method creates and dispatches a trusted event.
|
||||
@@ -2534,7 +2541,8 @@ public:
|
||||
*/
|
||||
static nsresult SetFetchReferrerURIWithPolicy(nsIPrincipal* aPrincipal,
|
||||
nsIDocument* aDoc,
|
||||
nsIHttpChannel* aChannel);
|
||||
nsIHttpChannel* aChannel,
|
||||
mozilla::net::ReferrerPolicy aReferrerPolicy);
|
||||
|
||||
static bool PushEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
|
||||
+10
-10
@@ -744,14 +744,14 @@ protected:
|
||||
JS::AutoIdVector &props) const;
|
||||
};
|
||||
|
||||
const js::Class OuterWindowProxyClass =
|
||||
PROXY_CLASS_WITH_EXT(
|
||||
"Proxy",
|
||||
0, /* additional class flags */
|
||||
PROXY_MAKE_EXT(
|
||||
false, /* isWrappedNative */
|
||||
nsOuterWindowProxy::ObjectMoved
|
||||
));
|
||||
static const js::ClassExtension OuterWindowProxyClassExtension = PROXY_MAKE_EXT(
|
||||
nsOuterWindowProxy::ObjectMoved
|
||||
);
|
||||
|
||||
const js::Class OuterWindowProxyClass = PROXY_CLASS_WITH_EXT(
|
||||
"Proxy",
|
||||
0, /* additional class flags */
|
||||
&OuterWindowProxyClassExtension);
|
||||
|
||||
const char *
|
||||
nsOuterWindowProxy::className(JSContext *cx, JS::Handle<JSObject*> proxy) const
|
||||
@@ -12150,7 +12150,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||
/* aCalledFromScript = */ true,
|
||||
aDialog, aNavigate, nullptr, argv,
|
||||
aLoadInfo,
|
||||
getter_AddRefs(domReturn));
|
||||
1.0f, 0, getter_AddRefs(domReturn));
|
||||
} else {
|
||||
// Force a system caller here so that the window watcher won't screw us
|
||||
// up. We do NOT want this case looking at the JS context on the stack
|
||||
@@ -12171,7 +12171,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||
/* aCalledFromScript = */ false,
|
||||
aDialog, aNavigate, nullptr, aExtraArgument,
|
||||
aLoadInfo,
|
||||
getter_AddRefs(domReturn));
|
||||
1.0f, 0, getter_AddRefs(domReturn));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2535,6 +2535,14 @@ SetMemoryGCDynamicMarkSlicePrefChangedCallback(const char* aPrefName, void* aClo
|
||||
JS_SetGCParameter(sRuntime, JSGC_DYNAMIC_MARK_SLICE, pref);
|
||||
}
|
||||
|
||||
static void
|
||||
SetMemoryGCRefreshFrameSlicesEnabledPrefChangedCallback(const char* aPrefName, void* aClosure)
|
||||
{
|
||||
bool pref = Preferences::GetBool(aPrefName);
|
||||
JS_SetGCParameter(sRuntime, JSGC_REFRESH_FRAME_SLICES_ENABLED, pref);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
SetIncrementalCCPrefChangedCallback(const char* aPrefName, void* aClosure)
|
||||
{
|
||||
@@ -2638,6 +2646,9 @@ nsJSContext::EnsureStatics()
|
||||
Preferences::RegisterCallbackAndCall(SetMemoryGCDynamicMarkSlicePrefChangedCallback,
|
||||
"javascript.options.mem.gc_dynamic_mark_slice");
|
||||
|
||||
Preferences::RegisterCallbackAndCall(SetMemoryGCRefreshFrameSlicesEnabledPrefChangedCallback,
|
||||
"javascript.options.mem.gc_refresh_frame_slices_enabled");
|
||||
|
||||
Preferences::RegisterCallbackAndCall(SetMemoryGCDynamicHeapGrowthPrefChangedCallback,
|
||||
"javascript.options.mem.gc_dynamic_heap_growth");
|
||||
|
||||
|
||||
@@ -2610,7 +2610,7 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
||||
nsCOMPtr<nsPIDOMWindow> owner = GetOwner();
|
||||
nsCOMPtr<nsIDocument> doc = owner ? owner->GetExtantDoc() : nullptr;
|
||||
nsContentUtils::SetFetchReferrerURIWithPolicy(mPrincipal, doc,
|
||||
httpChannel);
|
||||
httpChannel, mozilla::net::RP_Default);
|
||||
}
|
||||
|
||||
// Some extensions override the http protocol handler and provide their own
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
head =
|
||||
tail =
|
||||
skip-if = toolkit == 'android' || toolkit == 'gonk'
|
||||
support-files =
|
||||
!/dom/base/test/unit/test_bug553888.js
|
||||
!/dom/base/test/unit/test_xhr_document.js
|
||||
|
||||
[test_bug553888_wrap.js]
|
||||
[test_xhr_document_ipc.js]
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
var current_test = 0;
|
||||
|
||||
function shouldNotOpen(e) {
|
||||
var ws = e.target;
|
||||
ok(false, "onopen shouldn't be called on test " + ws._testNumber + "!");
|
||||
}
|
||||
|
||||
function shouldCloseCleanly(e) {
|
||||
var ws = e.target;
|
||||
ok(e.wasClean, "the ws connection in test " + ws._testNumber + " should be closed cleanly");
|
||||
}
|
||||
|
||||
function shouldCloseNotCleanly(e) {
|
||||
var ws = e.target;
|
||||
ok(!e.wasClean, "the ws connection in test " + ws._testNumber + " shouldn't be closed cleanly");
|
||||
}
|
||||
|
||||
function ignoreError(e) {
|
||||
}
|
||||
|
||||
function CreateTestWS(ws_location, ws_protocol) {
|
||||
var ws;
|
||||
|
||||
try {
|
||||
if (ws_protocol == undefined) {
|
||||
ws = new WebSocket(ws_location);
|
||||
} else {
|
||||
ws = new WebSocket(ws_location, ws_protocol);
|
||||
}
|
||||
|
||||
ws._testNumber = current_test;
|
||||
ok(true, "Created websocket for test " + ws._testNumber +"\n");
|
||||
|
||||
ws.onerror = function(e) {
|
||||
ok(false, "onerror called on test " + e.target._testNumber + "!");
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
return ws;
|
||||
}
|
||||
|
||||
function forcegc() {
|
||||
SpecialPowers.forceGC();
|
||||
SpecialPowers.gc();
|
||||
}
|
||||
|
||||
function feedback() {
|
||||
$("feedback").innerHTML = "executing test: " + (current_test+1) + " of " + tests.length + " tests.";
|
||||
}
|
||||
|
||||
function finish() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function doTest() {
|
||||
if (current_test >= tests.length) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
feedback();
|
||||
tests[current_test++]().then(doTest);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -50,11 +50,19 @@ protected:
|
||||
struct FastDictionaryInitializer {
|
||||
};
|
||||
|
||||
bool mIsAnyMemberPresent = false;
|
||||
|
||||
private:
|
||||
// aString is expected to actually be an nsAString*. Should only be
|
||||
// called from StringifyToJSON.
|
||||
static bool AppendJSONToString(const char16_t* aJSONData,
|
||||
uint32_t aDataLength, void* aString);
|
||||
|
||||
public:
|
||||
bool IsAnyMemberPresent() const
|
||||
{
|
||||
return mIsAnyMemberPresent;
|
||||
}
|
||||
};
|
||||
|
||||
// Struct that serves as a base class for all typed arrays and array buffers and
|
||||
|
||||
@@ -1803,6 +1803,21 @@ NativePropertyHooks sEmptyNativePropertyHooks = {
|
||||
nullptr
|
||||
};
|
||||
|
||||
const js::ClassOps sBoringInterfaceObjectClassClassOps = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
nullptr, /* setProperty */
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
nullptr, /* finalize */
|
||||
ThrowingConstructor, /* call */
|
||||
InterfaceHasInstance, /* hasInstance */
|
||||
ThrowingConstructor, /* construct */
|
||||
nullptr, /* trace */
|
||||
};
|
||||
|
||||
const js::ObjectOps sInterfaceObjectClassObjectOps = {
|
||||
nullptr, /* lookupProperty */
|
||||
nullptr, /* defineProperty */
|
||||
|
||||
@@ -2508,6 +2508,8 @@ XrayGetNativeProto(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
|
||||
extern NativePropertyHooks sEmptyNativePropertyHooks;
|
||||
|
||||
extern const js::ClassOps sBoringInterfaceObjectClassClassOps;
|
||||
|
||||
extern const js::ObjectOps sInterfaceObjectClassObjectOps;
|
||||
|
||||
// We use one constructor JSNative to represent all DOM interface objects (so
|
||||
@@ -2540,7 +2542,7 @@ inline bool
|
||||
HasConstructor(JSObject* obj)
|
||||
{
|
||||
return JS_IsNativeFunction(obj, Constructor) ||
|
||||
js::GetObjectClass(obj)->construct;
|
||||
js::GetObjectClass(obj)->getConstruct();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -983,7 +983,10 @@ DOMInterfaces = {
|
||||
},
|
||||
|
||||
'Request': {
|
||||
'binaryNames': { 'headers': 'headers_' },
|
||||
'binaryNames': {
|
||||
'headers': 'headers_',
|
||||
'referrerPolicy': 'referrerPolicy_'
|
||||
},
|
||||
},
|
||||
|
||||
'Response': {
|
||||
|
||||
+62
-45
@@ -440,27 +440,32 @@ class CGDOMJSClass(CGThing):
|
||||
|
||||
return fill(
|
||||
"""
|
||||
static const js::ClassOps sClassOps = {
|
||||
${addProperty}, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
nullptr, /* setProperty */
|
||||
${enumerate}, /* enumerate */
|
||||
${resolve}, /* resolve */
|
||||
${mayResolve}, /* mayResolve */
|
||||
${finalize}, /* finalize */
|
||||
${call}, /* call */
|
||||
nullptr, /* hasInstance */
|
||||
nullptr, /* construct */
|
||||
${trace}, /* trace */
|
||||
};
|
||||
|
||||
static const js::ClassExtension sClassExtension = {
|
||||
nullptr, /* weakmapKeyDelegateOp */
|
||||
${objectMoved} /* objectMovedOp */
|
||||
};
|
||||
|
||||
static const DOMJSClass sClass = {
|
||||
{ "${name}",
|
||||
${flags},
|
||||
${addProperty}, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
nullptr, /* setProperty */
|
||||
${enumerate}, /* enumerate */
|
||||
${resolve}, /* resolve */
|
||||
${mayResolve}, /* mayResolve */
|
||||
${finalize}, /* finalize */
|
||||
${call}, /* call */
|
||||
nullptr, /* hasInstance */
|
||||
nullptr, /* construct */
|
||||
${trace}, /* trace */
|
||||
&sClassOps,
|
||||
JS_NULL_CLASS_SPEC,
|
||||
{
|
||||
false, /* isWrappedNative */
|
||||
nullptr, /* weakmapKeyDelegateOp */
|
||||
${objectMoved} /* objectMovedOp */
|
||||
},
|
||||
&sClassExtension,
|
||||
JS_NULL_OBJECT_OPS
|
||||
},
|
||||
$*{descriptor}
|
||||
@@ -507,11 +512,14 @@ class CGDOMProxyJSClass(CGThing):
|
||||
objectMovedHook = OBJECT_MOVED_HOOK_NAME if self.descriptor.wrapperCache else 'nullptr'
|
||||
return fill(
|
||||
"""
|
||||
static const js::ClassExtension sClassExtension = PROXY_MAKE_EXT(
|
||||
${objectMoved}
|
||||
);
|
||||
|
||||
static const DOMJSClass sClass = {
|
||||
PROXY_CLASS_WITH_EXT("${name}",
|
||||
${flags},
|
||||
PROXY_MAKE_EXT(false, /* isWrappedNative */
|
||||
${objectMoved})),
|
||||
&sClassExtension),
|
||||
$*{descriptor}
|
||||
};
|
||||
""",
|
||||
@@ -590,18 +598,7 @@ class CGPrototypeJSClass(CGThing):
|
||||
{
|
||||
"${name}Prototype",
|
||||
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(${slotCount}),
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
nullptr, /* setProperty */
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
nullptr, /* finalize */
|
||||
nullptr, /* call */
|
||||
nullptr, /* hasInstance */
|
||||
nullptr, /* construct */
|
||||
nullptr, /* trace */
|
||||
JS_NULL_CLASS_OPS,
|
||||
JS_NULL_CLASS_SPEC,
|
||||
JS_NULL_CLASS_EXT,
|
||||
JS_NULL_OBJECT_OPS
|
||||
@@ -680,24 +677,39 @@ class CGInterfaceObjectJSClass(CGThing):
|
||||
len(self.descriptor.interface.namedConstructors))
|
||||
(protoGetter, _) = InterfaceObjectProtoGetter(self.descriptor)
|
||||
|
||||
return fill(
|
||||
if ctorname == "ThrowingConstructor" and hasinstance == "InterfaceHasInstance":
|
||||
ret = ""
|
||||
classOpsPtr = "&sBoringInterfaceObjectClassClassOps"
|
||||
else:
|
||||
ret = fill(
|
||||
"""
|
||||
static const js::ClassOps sInterfaceObjectClassOps = {
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
nullptr, /* setProperty */
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
nullptr, /* finalize */
|
||||
${ctorname}, /* call */
|
||||
${hasInstance}, /* hasInstance */
|
||||
${ctorname}, /* construct */
|
||||
nullptr, /* trace */
|
||||
};
|
||||
|
||||
""",
|
||||
ctorname=ctorname,
|
||||
hasInstance=hasinstance)
|
||||
classOpsPtr = "&sInterfaceObjectClassOps"
|
||||
|
||||
ret = ret + fill(
|
||||
"""
|
||||
static const DOMIfaceAndProtoJSClass sInterfaceObjectClass = {
|
||||
{
|
||||
"Function",
|
||||
JSCLASS_IS_DOMIFACEANDPROTOJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(${slotCount}),
|
||||
nullptr, /* addProperty */
|
||||
nullptr, /* delProperty */
|
||||
nullptr, /* getProperty */
|
||||
nullptr, /* setProperty */
|
||||
nullptr, /* enumerate */
|
||||
nullptr, /* resolve */
|
||||
nullptr, /* mayResolve */
|
||||
nullptr, /* finalize */
|
||||
${ctorname}, /* call */
|
||||
${hasInstance}, /* hasInstance */
|
||||
${ctorname}, /* construct */
|
||||
nullptr, /* trace */
|
||||
${classOpsPtr},
|
||||
JS_NULL_CLASS_SPEC,
|
||||
JS_NULL_CLASS_EXT,
|
||||
&sInterfaceObjectClassObjectOps
|
||||
@@ -713,12 +725,13 @@ class CGInterfaceObjectJSClass(CGThing):
|
||||
slotCount=slotCount,
|
||||
ctorname=ctorname,
|
||||
hasInstance=hasinstance,
|
||||
classOpsPtr=classOpsPtr,
|
||||
hooks=NativePropertyHooks(self.descriptor),
|
||||
name=self.descriptor.interface.identifier.name,
|
||||
prototypeID=prototypeID,
|
||||
depth=depth,
|
||||
protoGetter=protoGetter)
|
||||
|
||||
return ret
|
||||
|
||||
class CGList(CGThing):
|
||||
"""
|
||||
@@ -12543,6 +12556,10 @@ class CGDictionary(CGThing):
|
||||
"convert": string.Template(conversionInfo.template).substitute(replacements),
|
||||
"propGet": propGet
|
||||
}
|
||||
# The conversion code will only run where a default value or a value passed
|
||||
# by the author needs to get converted, so we can remember if we have any
|
||||
# members present here.
|
||||
conversionReplacements["convert"] += "mIsAnyMemberPresent = true;\n"
|
||||
conversion = ("if (!isNull && !${propGet}) {\n"
|
||||
" return false;\n"
|
||||
"}\n")
|
||||
|
||||
@@ -61,6 +61,7 @@ MSG_DEF(MSG_PERMISSION_DENIED_TO_PASS_ARG, 1, JSEXN_TYPEERR, "Permission denied
|
||||
MSG_DEF(MSG_MISSING_REQUIRED_DICTIONARY_MEMBER, 1, JSEXN_TYPEERR, "Missing required {0}.")
|
||||
MSG_DEF(MSG_INVALID_REQUEST_METHOD, 1, JSEXN_TYPEERR, "Invalid request method {0}.")
|
||||
MSG_DEF(MSG_INVALID_REQUEST_MODE, 1, JSEXN_TYPEERR, "Invalid request mode {0}.")
|
||||
MSG_DEF(MSG_INVALID_REFERRER_URL, 1, JSEXN_TYPEERR, "Invalid referrer URL {0}.")
|
||||
MSG_DEF(MSG_FETCH_BODY_CONSUMED_ERROR, 0, JSEXN_TYPEERR, "Body has already been consumed.")
|
||||
MSG_DEF(MSG_RESPONSE_INVALID_STATUSTEXT_ERROR, 0, JSEXN_TYPEERR, "Response statusText may not contain newline or carriage return.")
|
||||
MSG_DEF(MSG_FETCH_FAILED, 0, JSEXN_TYPEERR, "NetworkError when attempting to fetch resource.")
|
||||
|
||||
@@ -70,9 +70,7 @@ SimpleGlobal_moved(JSObject *obj, const JSObject *old)
|
||||
globalObject->UpdateWrapper(obj, old);
|
||||
}
|
||||
|
||||
const js::Class SimpleGlobalClass = {
|
||||
"",
|
||||
JSCLASS_GLOBAL_FLAGS | JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
|
||||
static const js::ClassOps SimpleGlobalClassOps = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
@@ -85,11 +83,20 @@ const js::Class SimpleGlobalClass = {
|
||||
nullptr,
|
||||
nullptr,
|
||||
JS_GlobalObjectTraceHook,
|
||||
JS_NULL_CLASS_SPEC, {
|
||||
false,
|
||||
nullptr,
|
||||
SimpleGlobal_moved
|
||||
}, JS_NULL_OBJECT_OPS
|
||||
};
|
||||
|
||||
static const js::ClassExtension SimpleGlobalClassExtension = {
|
||||
nullptr,
|
||||
SimpleGlobal_moved
|
||||
};
|
||||
|
||||
const js::Class SimpleGlobalClass = {
|
||||
"",
|
||||
JSCLASS_GLOBAL_FLAGS | JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
|
||||
&SimpleGlobalClassOps,
|
||||
JS_NULL_CLASS_SPEC,
|
||||
&SimpleGlobalClassExtension,
|
||||
JS_NULL_OBJECT_OPS
|
||||
};
|
||||
|
||||
// static
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
[DEFAULT]
|
||||
skip-if = buildapp == 'b2g'
|
||||
support-files =
|
||||
!/dom/bindings/test/file_bug707564.html
|
||||
!/dom/bindings/test/file_bug775543.html
|
||||
!/dom/bindings/test/file_document_location_set_via_xray.html
|
||||
!/dom/bindings/test/file_dom_xrays.html
|
||||
!/dom/bindings/test/file_proxies_via_xray.html
|
||||
|
||||
[test_bug707564-chrome.html]
|
||||
[test_bug775543.html]
|
||||
|
||||
@@ -8,6 +8,7 @@ support-files =
|
||||
file_dom_xrays.html
|
||||
file_proxies_via_xray.html
|
||||
forOf_iframe.html
|
||||
!/js/xpconnect/tests/mochitest/file_empty.html
|
||||
|
||||
[test_async_stacks.html]
|
||||
[test_ByteString.html]
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
[DEFAULT]
|
||||
# Good luck running these tests on anything but desktop Linux.
|
||||
skip-if = toolkit != "gtk2" || ((buildapp =='mulet' || buildapp == 'b2g') && (toolkit != 'gonk' || debug)) || e10s
|
||||
run-if = os == 'linux' && buildapp == 'browser' && !e10s
|
||||
support-files =
|
||||
file_Audio.html
|
||||
file_HighPriority.html
|
||||
file_MultipleFrames.html
|
||||
file_NestedFramesOuter.html
|
||||
file_WebGLContextLost.html
|
||||
silence.ogg
|
||||
!/dom/browser-element/mochitest/browserElementTestHelpers.js
|
||||
!/dom/browser-element/mochitest/file_empty.html
|
||||
|
||||
# Note: ../browserElementTestHelpers.js makes all tests in this directory OOP,
|
||||
# because testing the process-priority manager without OOP frames does not make
|
||||
@@ -9,22 +18,17 @@ skip-if = toolkit != "gtk2" || ((buildapp =='mulet' || buildapp == 'b2g') && (to
|
||||
[test_Simple.html]
|
||||
[test_Visibility.html]
|
||||
[test_HighPriority.html]
|
||||
support-files = file_HighPriority.html
|
||||
[test_Background.html]
|
||||
[test_BackgroundLRU.html]
|
||||
[test_Activity.html]
|
||||
[test_Audio.html]
|
||||
support-files = file_Audio.html silence.ogg
|
||||
[test_Keyboard.html]
|
||||
[test_MultipleActivities.html]
|
||||
[test_MultipleFrames.html]
|
||||
support-files = file_MultipleFrames.html
|
||||
[test_Preallocated.html]
|
||||
disabled = bug 968604, bug 987164
|
||||
[test_ExpectingSystemMessage.html]
|
||||
[test_ExpectingSystemMessage2.html]
|
||||
[test_NestedFrames.html]
|
||||
support-files = file_NestedFramesOuter.html
|
||||
[test_WebGLContextLost.html]
|
||||
disabled = bug 865844
|
||||
support-files = file_WebGLContextLost.html
|
||||
|
||||
Vendored
+2
@@ -10,6 +10,7 @@ include ChannelInfo;
|
||||
include PBackgroundSharedTypes;
|
||||
|
||||
using HeadersGuardEnum from "mozilla/dom/cache/IPCUtils.h";
|
||||
using ReferrerPolicy from "mozilla/dom/cache/IPCUtils.h";
|
||||
using RequestCredentials from "mozilla/dom/cache/IPCUtils.h";
|
||||
using RequestMode from "mozilla/dom/cache/IPCUtils.h";
|
||||
using RequestCache from "mozilla/dom/cache/IPCUtils.h";
|
||||
@@ -60,6 +61,7 @@ struct CacheRequest
|
||||
HeadersEntry[] headers;
|
||||
HeadersGuardEnum headersGuard;
|
||||
nsString referrer;
|
||||
ReferrerPolicy referrerPolicy;
|
||||
RequestMode mode;
|
||||
RequestCredentials credentials;
|
||||
CacheReadStreamOrVoid body;
|
||||
|
||||
Vendored
+121
-67
@@ -37,7 +37,7 @@ const int32_t kFirstShippedSchemaVersion = 15;
|
||||
namespace {
|
||||
|
||||
// Update this whenever the DB schema is changed.
|
||||
const int32_t kLatestSchemaVersion = 19;
|
||||
const int32_t kLatestSchemaVersion = 20;
|
||||
|
||||
// ---------
|
||||
// The following constants define the SQL schema. These are defined in the
|
||||
@@ -104,9 +104,10 @@ const char* const kTableEntries =
|
||||
"response_principal_info TEXT NOT NULL, "
|
||||
"cache_id INTEGER NOT NULL REFERENCES caches(id) ON DELETE CASCADE, "
|
||||
|
||||
"request_redirect INTEGER NOT NULL, "
|
||||
"request_referrer_policy INTEGER NOT NULL"
|
||||
// New columns must be added at the end of table to migrate and
|
||||
// validate properly.
|
||||
"request_redirect INTEGER NOT NULL"
|
||||
")";
|
||||
|
||||
// Create an index to support the QueryCache() matching algorithm. This
|
||||
@@ -189,6 +190,14 @@ static_assert(int(HeadersGuardEnum::None) == 0 &&
|
||||
int(HeadersGuardEnum::Immutable) == 4 &&
|
||||
int(HeadersGuardEnum::EndGuard_) == 5,
|
||||
"HeadersGuardEnum values are as expected");
|
||||
static_assert(int(ReferrerPolicy::_empty) == 0 &&
|
||||
int(ReferrerPolicy::No_referrer) == 1 &&
|
||||
int(ReferrerPolicy::No_referrer_when_downgrade) == 2 &&
|
||||
int(ReferrerPolicy::Origin) == 3 &&
|
||||
int(ReferrerPolicy::Origin_when_cross_origin) == 4 &&
|
||||
int(ReferrerPolicy::Unsafe_url) == 5 &&
|
||||
int(ReferrerPolicy::EndGuard_) == 6,
|
||||
"ReferrerPolicy values are as expected");
|
||||
static_assert(int(RequestMode::Same_origin) == 0 &&
|
||||
int(RequestMode::No_cors) == 1 &&
|
||||
int(RequestMode::Cors) == 2 &&
|
||||
@@ -1635,6 +1644,7 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
"request_url_query, "
|
||||
"request_url_query_hash, "
|
||||
"request_referrer, "
|
||||
"request_referrer_policy, "
|
||||
"request_headers_guard, "
|
||||
"request_mode, "
|
||||
"request_credentials, "
|
||||
@@ -1658,6 +1668,7 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
":request_url_query, "
|
||||
":request_url_query_hash, "
|
||||
":request_referrer, "
|
||||
":request_referrer_policy, "
|
||||
":request_headers_guard, "
|
||||
":request_mode, "
|
||||
":request_credentials, "
|
||||
@@ -1710,6 +1721,10 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
aRequest.referrer());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("request_referrer_policy"),
|
||||
static_cast<int32_t>(aRequest.referrerPolicy()));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = state->BindInt32ByName(NS_LITERAL_CSTRING("request_headers_guard"),
|
||||
static_cast<int32_t>(aRequest.headersGuard()));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
@@ -1988,6 +2003,7 @@ ReadRequest(mozIStorageConnection* aConn, EntryId aEntryId,
|
||||
"request_url_no_query, "
|
||||
"request_url_query, "
|
||||
"request_referrer, "
|
||||
"request_referrer_policy, "
|
||||
"request_headers_guard, "
|
||||
"request_mode, "
|
||||
"request_credentials, "
|
||||
@@ -2019,48 +2035,54 @@ ReadRequest(mozIStorageConnection* aConn, EntryId aEntryId,
|
||||
rv = state->GetString(3, aSavedRequestOut->mValue.referrer());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
int32_t referrerPolicy;
|
||||
rv = state->GetInt32(4, &referrerPolicy);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
aSavedRequestOut->mValue.referrerPolicy() =
|
||||
static_cast<ReferrerPolicy>(referrerPolicy);
|
||||
|
||||
int32_t guard;
|
||||
rv = state->GetInt32(4, &guard);
|
||||
rv = state->GetInt32(5, &guard);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
aSavedRequestOut->mValue.headersGuard() =
|
||||
static_cast<HeadersGuardEnum>(guard);
|
||||
|
||||
int32_t mode;
|
||||
rv = state->GetInt32(5, &mode);
|
||||
rv = state->GetInt32(6, &mode);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
aSavedRequestOut->mValue.mode() = static_cast<RequestMode>(mode);
|
||||
|
||||
int32_t credentials;
|
||||
rv = state->GetInt32(6, &credentials);
|
||||
rv = state->GetInt32(7, &credentials);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
aSavedRequestOut->mValue.credentials() =
|
||||
static_cast<RequestCredentials>(credentials);
|
||||
|
||||
int32_t requestContentPolicyType;
|
||||
rv = state->GetInt32(7, &requestContentPolicyType);
|
||||
rv = state->GetInt32(8, &requestContentPolicyType);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
aSavedRequestOut->mValue.contentPolicyType() =
|
||||
static_cast<nsContentPolicyType>(requestContentPolicyType);
|
||||
|
||||
int32_t requestCache;
|
||||
rv = state->GetInt32(8, &requestCache);
|
||||
rv = state->GetInt32(9, &requestCache);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
aSavedRequestOut->mValue.requestCache() =
|
||||
static_cast<RequestCache>(requestCache);
|
||||
|
||||
int32_t requestRedirect;
|
||||
rv = state->GetInt32(9, &requestRedirect);
|
||||
rv = state->GetInt32(10, &requestRedirect);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
aSavedRequestOut->mValue.requestRedirect() =
|
||||
static_cast<RequestRedirect>(requestRedirect);
|
||||
|
||||
bool nullBody = false;
|
||||
rv = state->GetIsNull(10, &nullBody);
|
||||
rv = state->GetIsNull(11, &nullBody);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
aSavedRequestOut->mHasBodyId = !nullBody;
|
||||
|
||||
if (aSavedRequestOut->mHasBodyId) {
|
||||
rv = ExtractId(state, 10, &aSavedRequestOut->mBodyId);
|
||||
rv = ExtractId(state, 11, &aSavedRequestOut->mBodyId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
}
|
||||
|
||||
@@ -2396,10 +2418,10 @@ Validate(mozIStorageConnection* aConn)
|
||||
// Schema migration code
|
||||
// -----
|
||||
|
||||
typedef nsresult (*MigrationFunc)(mozIStorageConnection*);
|
||||
typedef nsresult (*MigrationFunc)(mozIStorageConnection*, bool&);
|
||||
struct Migration
|
||||
{
|
||||
Migration(int32_t aFromVersion, MigrationFunc aFunc)
|
||||
MOZ_CONSTEXPR Migration(int32_t aFromVersion, MigrationFunc aFunc)
|
||||
: mFromVersion(aFromVersion)
|
||||
, mFunc(aFunc)
|
||||
{ }
|
||||
@@ -2409,10 +2431,11 @@ struct Migration
|
||||
|
||||
// Declare migration functions here. Each function should upgrade
|
||||
// the version by a single increment. Don't skip versions.
|
||||
nsresult MigrateFrom15To16(mozIStorageConnection* aConn);
|
||||
nsresult MigrateFrom16To17(mozIStorageConnection* aConn);
|
||||
nsresult MigrateFrom17To18(mozIStorageConnection* aConn);
|
||||
nsresult MigrateFrom18To19(mozIStorageConnection* aConn);
|
||||
nsresult MigrateFrom15To16(mozIStorageConnection* aConn, bool& aRewriteSchema);
|
||||
nsresult MigrateFrom16To17(mozIStorageConnection* aConn, bool& aRewriteSchema);
|
||||
nsresult MigrateFrom17To18(mozIStorageConnection* aConn, bool& aRewriteSchema);
|
||||
nsresult MigrateFrom18To19(mozIStorageConnection* aConn, bool& aRewriteSchema);
|
||||
nsresult MigrateFrom19To20(mozIStorageConnection* aConn, bool& aRewriteSchema);
|
||||
|
||||
// Configure migration functions to run for the given starting version.
|
||||
Migration sMigrationList[] = {
|
||||
@@ -2420,45 +2443,11 @@ Migration sMigrationList[] = {
|
||||
Migration(16, MigrateFrom16To17),
|
||||
Migration(17, MigrateFrom17To18),
|
||||
Migration(18, MigrateFrom18To19),
|
||||
Migration(19, MigrateFrom19To20),
|
||||
};
|
||||
|
||||
uint32_t sMigrationListLength = sizeof(sMigrationList) / sizeof(Migration);
|
||||
|
||||
nsresult
|
||||
Migrate(mozIStorageConnection* aConn)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
|
||||
int32_t currentVersion = 0;
|
||||
nsresult rv = aConn->GetSchemaVersion(¤tVersion);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
while (currentVersion < kLatestSchemaVersion) {
|
||||
// Wiping old databases is handled in DBAction because it requires
|
||||
// making a whole new mozIStorageConnection. Make sure we don't
|
||||
// accidentally get here for one of those old databases.
|
||||
MOZ_ASSERT(currentVersion >= kFirstShippedSchemaVersion);
|
||||
|
||||
for (uint32_t i = 0; i < sMigrationListLength; ++i) {
|
||||
if (sMigrationList[i].mFromVersion == currentVersion) {
|
||||
rv = sMigrationList[i].mFunc(aConn);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DebugOnly<int32_t> lastVersion = currentVersion;
|
||||
rv = aConn->GetSchemaVersion(¤tVersion);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
MOZ_ASSERT(currentVersion > lastVersion);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(currentVersion == kLatestSchemaVersion);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
RewriteEntriesSchema(mozIStorageConnection* aConn)
|
||||
{
|
||||
@@ -2488,7 +2477,55 @@ RewriteEntriesSchema(mozIStorageConnection* aConn)
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult MigrateFrom15To16(mozIStorageConnection* aConn)
|
||||
nsresult
|
||||
Migrate(mozIStorageConnection* aConn)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
|
||||
int32_t currentVersion = 0;
|
||||
nsresult rv = aConn->GetSchemaVersion(¤tVersion);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
bool rewriteSchema = false;
|
||||
|
||||
while (currentVersion < kLatestSchemaVersion) {
|
||||
// Wiping old databases is handled in DBAction because it requires
|
||||
// making a whole new mozIStorageConnection. Make sure we don't
|
||||
// accidentally get here for one of those old databases.
|
||||
MOZ_ASSERT(currentVersion >= kFirstShippedSchemaVersion);
|
||||
|
||||
for (uint32_t i = 0; i < sMigrationListLength; ++i) {
|
||||
if (sMigrationList[i].mFromVersion == currentVersion) {
|
||||
bool shouldRewrite = false;
|
||||
rv = sMigrationList[i].mFunc(aConn, shouldRewrite);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
if (shouldRewrite) {
|
||||
rewriteSchema = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DebugOnly<int32_t> lastVersion = currentVersion;
|
||||
rv = aConn->GetSchemaVersion(¤tVersion);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
MOZ_ASSERT(currentVersion > lastVersion);
|
||||
}
|
||||
|
||||
MOZ_ASSERT(currentVersion == kLatestSchemaVersion);
|
||||
|
||||
if (rewriteSchema) {
|
||||
// Now overwrite the master SQL for the entries table to remove the column
|
||||
// default value. This is also necessary for our Validate() method to
|
||||
// pass on this database.
|
||||
rv = RewriteEntriesSchema(aConn);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult MigrateFrom15To16(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
@@ -2507,20 +2544,16 @@ nsresult MigrateFrom15To16(mozIStorageConnection* aConn)
|
||||
));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
// Now overwrite the master SQL for the entries table to remove the column
|
||||
// default value. This is also necessary for our Validate() method to
|
||||
// pass on this database.
|
||||
rv = RewriteEntriesSchema(aConn);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = aConn->SetSchemaVersion(16);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
aRewriteSchema = true;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
MigrateFrom16To17(mozIStorageConnection* aConn)
|
||||
MigrateFrom16To17(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
@@ -2645,12 +2678,6 @@ MigrateFrom16To17(mozIStorageConnection* aConn)
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
if (NS_WARN_IF(hasMoreData)) { return NS_ERROR_FAILURE; }
|
||||
|
||||
// Finally, rewrite the schema for the entries database, otherwise the
|
||||
// returned SQL string from sqlite will wrap the name of the table in quotes,
|
||||
// breaking the checks in Validate().
|
||||
rv = RewriteEntriesSchema(aConn);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = aConn->SetSchemaVersion(17);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
@@ -2658,7 +2685,7 @@ MigrateFrom16To17(mozIStorageConnection* aConn)
|
||||
}
|
||||
|
||||
nsresult
|
||||
MigrateFrom17To18(mozIStorageConnection* aConn)
|
||||
MigrateFrom17To18(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
@@ -2688,7 +2715,7 @@ MigrateFrom17To18(mozIStorageConnection* aConn)
|
||||
}
|
||||
|
||||
nsresult
|
||||
MigrateFrom18To19(mozIStorageConnection* aConn)
|
||||
MigrateFrom18To19(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
@@ -2719,6 +2746,33 @@ MigrateFrom18To19(mozIStorageConnection* aConn)
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult MigrateFrom19To20(mozIStorageConnection* aConn, bool& aRewriteSchema)
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
MOZ_ASSERT(aConn);
|
||||
|
||||
mozStorageTransaction trans(aConn, true,
|
||||
mozIStorageConnection::TRANSACTION_IMMEDIATE);
|
||||
|
||||
// Add the request_referrer_policy column with a default value of
|
||||
// "no-referrer-when-downgrade". Note, we only use a default value here
|
||||
// because its required by ALTER TABLE and we need to apply the default
|
||||
// "no-referrer-when-downgrade" to existing records in the table. We don't
|
||||
// actually want to keep the default in the schema for future INSERTs.
|
||||
nsresult rv = aConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
"ALTER TABLE entries "
|
||||
"ADD COLUMN request_referrer_policy INTEGER NOT NULL DEFAULT 2"
|
||||
));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
rv = aConn->SetSchemaVersion(20);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
|
||||
|
||||
aRewriteSchema = true;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
Vendored
+5
@@ -24,6 +24,11 @@ namespace IPC {
|
||||
mozilla::dom::HeadersGuardEnum::None,
|
||||
mozilla::dom::HeadersGuardEnum::EndGuard_> {};
|
||||
template<>
|
||||
struct ParamTraits<mozilla::dom::ReferrerPolicy> :
|
||||
public ContiguousEnumSerializer<mozilla::dom::ReferrerPolicy,
|
||||
mozilla::dom::ReferrerPolicy::_empty,
|
||||
mozilla::dom::ReferrerPolicy::EndGuard_> {};
|
||||
template<>
|
||||
struct ParamTraits<mozilla::dom::RequestMode> :
|
||||
public ContiguousEnumSerializer<mozilla::dom::RequestMode,
|
||||
mozilla::dom::RequestMode::Same_origin,
|
||||
|
||||
Vendored
+2
@@ -170,6 +170,7 @@ TypeUtils::ToCacheRequest(CacheRequest& aOut, InternalRequest* aIn,
|
||||
}
|
||||
|
||||
aIn->GetReferrer(aOut.referrer());
|
||||
aOut.referrerPolicy() = aIn->ReferrerPolicy_();
|
||||
|
||||
RefPtr<InternalHeaders> headers = aIn->Headers();
|
||||
MOZ_ASSERT(headers);
|
||||
@@ -340,6 +341,7 @@ TypeUtils::ToInternalRequest(const CacheRequest& aIn)
|
||||
internalRequest->SetURL(url);
|
||||
|
||||
internalRequest->SetReferrer(aIn.referrer());
|
||||
internalRequest->SetReferrerPolicy(aIn.referrerPolicy());
|
||||
internalRequest->SetMode(aIn.mode());
|
||||
internalRequest->SetCredentialsMode(aIn.credentials());
|
||||
internalRequest->SetContentPolicyType(aIn.contentPolicyType());
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ function run_test() {
|
||||
ok(request.redirect === 'follow', 'request.redirect should default to "follow"');
|
||||
ok(request.cache === 'default', 'request.cache should have been updated to "default"' + request.cache);
|
||||
ok(request.mode === 'navigate', 'request.mode should have been updated to "navigate"');
|
||||
ok(request.referrerPolicy === 'no-referrer-when-downgrade', 'request.referrerPolicy should have been updated to "no-referrer-when-downgrade"');
|
||||
});
|
||||
return Promise.all(requestList.map(function(request) {
|
||||
return cache.match(request);
|
||||
|
||||
@@ -13,6 +13,7 @@ support-files =
|
||||
window_bug493251.html
|
||||
window_bug659071.html
|
||||
window_wheel_default_action.html
|
||||
!/gfx/layers/apz/test/mochitest/apz_test_utils.js
|
||||
|
||||
[test_accel_virtual_modifier.html]
|
||||
[test_addEventListenerExtraArg.html]
|
||||
|
||||
@@ -154,6 +154,14 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Double check that we have chrome privileges if the Request's content
|
||||
// policy type has been overridden. Note, we must do this before
|
||||
// entering the global below. Otherwise the IsCallerChrome() will
|
||||
// always fail.
|
||||
MOZ_ASSERT_IF(aInput.IsRequest() &&
|
||||
aInput.GetAsRequest().IsContentPolicyTypeOverridden(),
|
||||
nsContentUtils::IsCallerChrome());
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init(aGlobal);
|
||||
JSContext* cx = jsapi.cx();
|
||||
|
||||
+111
-48
@@ -42,7 +42,7 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS(FetchDriver,
|
||||
nsIStreamListener, nsIInterfaceRequestor,
|
||||
nsIStreamListener, nsIChannelEventSink, nsIInterfaceRequestor,
|
||||
nsIThreadRetargetableStreamListener)
|
||||
|
||||
FetchDriver::FetchDriver(InternalRequest* aRequest, nsIPrincipal* aPrincipal,
|
||||
@@ -129,6 +129,15 @@ FetchDriver::HttpFetch()
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
// non-GET requests aren't allowed for blob.
|
||||
if (IsBlobURI(uri)) {
|
||||
nsAutoCString method;
|
||||
mRequest->GetMethod(method);
|
||||
if (!method.EqualsLiteral("GET")) {
|
||||
return NS_ERROR_DOM_NETWORK_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
// Step 2 deals with letting ServiceWorkers intercept requests. This is
|
||||
// handled by Necko after the channel is opened.
|
||||
// FIXME(nsm): Bug 1119026: The channel's skip service worker flag should be
|
||||
@@ -221,11 +230,16 @@ FetchDriver::HttpFetch()
|
||||
|
||||
mLoadGroup = nullptr;
|
||||
|
||||
// FIXME(nsm): Bug 1120715.
|
||||
// Step 3.4 "If request's cache mode is default and request's header list
|
||||
// contains a header named `If-Modified-Since`, `If-None-Match`,
|
||||
// `If-Unmodified-Since`, `If-Match`, or `If-Range`, set request's cache mode
|
||||
// to no-store."
|
||||
// Insert ourselves into the notification callbacks chain so we can set
|
||||
// headers on redirects.
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIInterfaceRequestor> notificationCallbacks;
|
||||
chan->GetNotificationCallbacks(getter_AddRefs(notificationCallbacks));
|
||||
MOZ_ASSERT(!notificationCallbacks);
|
||||
}
|
||||
#endif
|
||||
chan->SetNotificationCallbacks(this);
|
||||
|
||||
// Step 3.5 begins "HTTP network or cache fetch".
|
||||
// HTTP network or cache fetch
|
||||
@@ -240,33 +254,41 @@ FetchDriver::HttpFetch()
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Set the same headers.
|
||||
AutoTArray<InternalHeaders::Entry, 5> headers;
|
||||
mRequest->Headers()->GetEntries(headers);
|
||||
bool hasAccept = false;
|
||||
for (uint32_t i = 0; i < headers.Length(); ++i) {
|
||||
if (!hasAccept && headers[i].mName.EqualsLiteral("accept")) {
|
||||
hasAccept = true;
|
||||
}
|
||||
if (headers[i].mValue.IsEmpty()) {
|
||||
httpChan->SetEmptyRequestHeader(headers[i].mName);
|
||||
} else {
|
||||
httpChan->SetRequestHeader(headers[i].mName, headers[i].mValue, false /* merge */);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAccept) {
|
||||
httpChan->SetRequestHeader(NS_LITERAL_CSTRING("accept"),
|
||||
NS_LITERAL_CSTRING("*/*"),
|
||||
false /* merge */);
|
||||
}
|
||||
SetRequestHeaders(httpChan);
|
||||
|
||||
// Step 2. Set the referrer.
|
||||
nsAutoString referrer;
|
||||
mRequest->GetReferrer(referrer);
|
||||
ReferrerPolicy referrerPolicy = mRequest->ReferrerPolicy_();
|
||||
net::ReferrerPolicy net_referrerPolicy = net::RP_Unset;
|
||||
switch (referrerPolicy) {
|
||||
case ReferrerPolicy::_empty:
|
||||
net_referrerPolicy = net::RP_Default;
|
||||
break;
|
||||
case ReferrerPolicy::No_referrer:
|
||||
net_referrerPolicy = net::RP_No_Referrer;
|
||||
break;
|
||||
case ReferrerPolicy::No_referrer_when_downgrade:
|
||||
net_referrerPolicy = net::RP_No_Referrer_When_Downgrade;
|
||||
break;
|
||||
case ReferrerPolicy::Origin:
|
||||
net_referrerPolicy = net::RP_Origin;
|
||||
break;
|
||||
case ReferrerPolicy::Origin_when_cross_origin:
|
||||
net_referrerPolicy = net::RP_Origin_When_Crossorigin;
|
||||
break;
|
||||
case ReferrerPolicy::Unsafe_url:
|
||||
net_referrerPolicy = net::RP_Unsafe_URL;
|
||||
break;
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid ReferrerPolicy enum value?");
|
||||
break;
|
||||
}
|
||||
if (referrer.EqualsLiteral(kFETCH_CLIENT_REFERRER_STR)) {
|
||||
rv = nsContentUtils::SetFetchReferrerURIWithPolicy(mPrincipal,
|
||||
mDocument,
|
||||
httpChan);
|
||||
httpChan,
|
||||
net_referrerPolicy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else if (referrer.IsEmpty()) {
|
||||
rv = httpChan->SetReferrerWithPolicy(nullptr, net::RP_No_Referrer);
|
||||
@@ -275,32 +297,20 @@ FetchDriver::HttpFetch()
|
||||
// From "Determine request's Referrer" step 3
|
||||
// "If request's referrer is a URL, let referrerSource be request's
|
||||
// referrer."
|
||||
//
|
||||
// XXXnsm - We never actually hit this from a fetch() call since both
|
||||
// fetch and Request() create a new internal request whose referrer is
|
||||
// always set to about:client. Should we just crash here instead until
|
||||
// someone tries to use FetchDriver for non-fetch() APIs?
|
||||
nsCOMPtr<nsIURI> referrerURI;
|
||||
rv = NS_NewURI(getter_AddRefs(referrerURI), referrer, nullptr, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t documentReferrerPolicy = mDocument ? mDocument->GetReferrerPolicy() :
|
||||
net::RP_Default;
|
||||
rv =
|
||||
httpChan->SetReferrerWithPolicy(referrerURI,
|
||||
mDocument ? mDocument->GetReferrerPolicy() :
|
||||
net::RP_Default);
|
||||
referrerPolicy == ReferrerPolicy::_empty ?
|
||||
documentReferrerPolicy :
|
||||
net_referrerPolicy);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Step 3 "If HTTPRequest's force Origin header flag is set..."
|
||||
if (mRequest->ForceOriginHeader()) {
|
||||
nsAutoString origin;
|
||||
rv = nsContentUtils::GetUTFOrigin(mPrincipal, origin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
httpChan->SetRequestHeader(NS_LITERAL_CSTRING("origin"),
|
||||
NS_ConvertUTF16toUTF8(origin),
|
||||
false /* merge */);
|
||||
}
|
||||
// Bug 1120722 - Authorization will be handled later.
|
||||
// Auth may require prompting, we don't support it yet.
|
||||
// The next patch in this same bug prevents this from aborting the request.
|
||||
@@ -312,12 +322,11 @@ FetchDriver::HttpFetch()
|
||||
// dom/workers/ServiceWorkerManager.cpp
|
||||
internalChan->SetCorsMode(static_cast<uint32_t>(mRequest->Mode()));
|
||||
internalChan->SetRedirectMode(static_cast<uint32_t>(mRequest->GetRedirectMode()));
|
||||
mRequest->MaybeSkipCacheIfPerformingRevalidation();
|
||||
internalChan->SetFetchCacheMode(static_cast<uint32_t>(mRequest->GetCacheMode()));
|
||||
}
|
||||
|
||||
// Step 5. Proxy authentication will be handled by Necko.
|
||||
// FIXME(nsm): Bug 1120715.
|
||||
// Step 7-10. "If request's cache mode is neither no-store nor reload..."
|
||||
|
||||
// Continue setting up 'HTTPRequest'. Content-Type and body data.
|
||||
nsCOMPtr<nsIUploadChannel2> uploadChan = do_QueryInterface(chan);
|
||||
@@ -401,7 +410,7 @@ FetchDriver::BeginAndGetFilteredResponse(InternalResponse* aResponse,
|
||||
return filteredResponse.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
FetchDriver::FailWithNetworkError()
|
||||
{
|
||||
workers::AssertIsOnMainThread();
|
||||
@@ -412,7 +421,6 @@ FetchDriver::FailWithNetworkError()
|
||||
mObserver->OnResponseEnd();
|
||||
mObserver = nullptr;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -459,7 +467,7 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest,
|
||||
|
||||
nsresult rv;
|
||||
aRequest->GetStatus(&rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
if (NS_FAILED(rv)) {
|
||||
FailWithNetworkError();
|
||||
return rv;
|
||||
}
|
||||
@@ -662,6 +670,21 @@ FetchDriver::OnStopRequest(nsIRequest* aRequest,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FetchDriver::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
|
||||
nsIChannel* aNewChannel,
|
||||
uint32_t aFlags,
|
||||
nsIAsyncVerifyRedirectCallback *aCallback)
|
||||
{
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aNewChannel);
|
||||
if (httpChannel) {
|
||||
SetRequestHeaders(httpChannel);
|
||||
}
|
||||
|
||||
aCallback->OnRedirectVerifyCallback(NS_OK);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FetchDriver::CheckListenerChain()
|
||||
{
|
||||
@@ -671,6 +694,11 @@ FetchDriver::CheckListenerChain()
|
||||
NS_IMETHODIMP
|
||||
FetchDriver::GetInterface(const nsIID& aIID, void **aResult)
|
||||
{
|
||||
if (aIID.Equals(NS_GET_IID(nsIChannelEventSink))) {
|
||||
*aResult = static_cast<nsIChannelEventSink*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIStreamListener))) {
|
||||
*aResult = static_cast<nsIStreamListener*>(this);
|
||||
NS_ADDREF_THIS();
|
||||
@@ -693,5 +721,40 @@ FetchDriver::SetDocument(nsIDocument* aDocument)
|
||||
mDocument = aDocument;
|
||||
}
|
||||
|
||||
void
|
||||
FetchDriver::SetRequestHeaders(nsIHttpChannel* aChannel) const
|
||||
{
|
||||
MOZ_ASSERT(aChannel);
|
||||
|
||||
AutoTArray<InternalHeaders::Entry, 5> headers;
|
||||
mRequest->Headers()->GetEntries(headers);
|
||||
bool hasAccept = false;
|
||||
for (uint32_t i = 0; i < headers.Length(); ++i) {
|
||||
if (!hasAccept && headers[i].mName.EqualsLiteral("accept")) {
|
||||
hasAccept = true;
|
||||
}
|
||||
if (headers[i].mValue.IsEmpty()) {
|
||||
aChannel->SetEmptyRequestHeader(headers[i].mName);
|
||||
} else {
|
||||
aChannel->SetRequestHeader(headers[i].mName, headers[i].mValue, false /* merge */);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAccept) {
|
||||
aChannel->SetRequestHeader(NS_LITERAL_CSTRING("accept"),
|
||||
NS_LITERAL_CSTRING("*/*"),
|
||||
false /* merge */);
|
||||
}
|
||||
|
||||
if (mRequest->ForceOriginHeader()) {
|
||||
nsAutoString origin;
|
||||
if (NS_SUCCEEDED(nsContentUtils::GetUTFOrigin(mPrincipal, origin))) {
|
||||
aChannel->SetRequestHeader(NS_LITERAL_CSTRING("origin"),
|
||||
NS_ConvertUTF16toUTF8(origin),
|
||||
false /* merge */);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -55,6 +55,7 @@ private:
|
||||
};
|
||||
|
||||
class FetchDriver final : public nsIStreamListener,
|
||||
public nsIChannelEventSink,
|
||||
public nsIInterfaceRequestor,
|
||||
public nsIThreadRetargetableStreamListener
|
||||
{
|
||||
@@ -62,6 +63,7 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
NS_DECL_NSICHANNELEVENTSINK
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
|
||||
|
||||
@@ -98,7 +100,9 @@ private:
|
||||
bool aFoundOpaqueRedirect);
|
||||
// Utility since not all cases need to do any post processing of the filtered
|
||||
// response.
|
||||
nsresult FailWithNetworkError();
|
||||
void FailWithNetworkError();
|
||||
|
||||
void SetRequestHeaders(nsIHttpChannel* aChannel) const;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -174,6 +174,17 @@ InternalHeaders::IsSimpleHeader(const nsACString& aName, const nsACString& aValu
|
||||
nsContentUtils::IsAllowedNonCorsContentType(aValue));
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
InternalHeaders::IsRevalidationHeader(const nsACString& aName)
|
||||
{
|
||||
return aName.EqualsLiteral("if-modified-since") ||
|
||||
aName.EqualsLiteral("if-none-match") ||
|
||||
aName.EqualsLiteral("if-unmodified-since") ||
|
||||
aName.EqualsLiteral("if-match") ||
|
||||
aName.EqualsLiteral("if-range");
|
||||
}
|
||||
|
||||
//static
|
||||
bool
|
||||
InternalHeaders::IsInvalidName(const nsACString& aName, ErrorResult& aRv)
|
||||
@@ -283,6 +294,18 @@ InternalHeaders::HasOnlySimpleHeaders() const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
InternalHeaders::HasRevalidationHeaders() const
|
||||
{
|
||||
for (uint32_t i = 0; i < mList.Length(); ++i) {
|
||||
if (IsRevalidationHeader(mList[i].mName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<InternalHeaders>
|
||||
InternalHeaders::BasicHeaders(InternalHeaders* aHeaders)
|
||||
|
||||
@@ -99,6 +99,8 @@ public:
|
||||
|
||||
bool HasOnlySimpleHeaders() const;
|
||||
|
||||
bool HasRevalidationHeaders() const;
|
||||
|
||||
static already_AddRefed<InternalHeaders>
|
||||
BasicHeaders(InternalHeaders* aHeaders);
|
||||
|
||||
@@ -142,6 +144,8 @@ private:
|
||||
|
||||
static bool IsSimpleHeader(const nsACString& aName,
|
||||
const nsACString& aValue);
|
||||
|
||||
static bool IsRevalidationHeader(const nsACString& aName);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -37,13 +37,17 @@ InternalRequest::GetRequestConstructorCopy(nsIGlobalObject* aGlobal, ErrorResult
|
||||
copy->mSameOriginDataURL = true;
|
||||
copy->mPreserveContentCodings = true;
|
||||
// The default referrer is already about:client.
|
||||
copy->mReferrerPolicy = mReferrerPolicy;
|
||||
|
||||
copy->mContentPolicyType = nsIContentPolicy::TYPE_FETCH;
|
||||
copy->mContentPolicyType = mContentPolicyTypeOverridden ?
|
||||
mContentPolicyType :
|
||||
nsIContentPolicy::TYPE_FETCH;
|
||||
copy->mMode = mMode;
|
||||
copy->mCredentialsMode = mCredentialsMode;
|
||||
copy->mCacheMode = mCacheMode;
|
||||
copy->mRedirectMode = mRedirectMode;
|
||||
copy->mCreatedByFetchEvent = mCreatedByFetchEvent;
|
||||
copy->mContentPolicyTypeOverridden = mContentPolicyTypeOverridden;
|
||||
return copy.forget();
|
||||
}
|
||||
|
||||
@@ -77,6 +81,7 @@ InternalRequest::InternalRequest(const InternalRequest& aOther)
|
||||
, mHeaders(new InternalHeaders(*aOther.mHeaders))
|
||||
, mContentPolicyType(aOther.mContentPolicyType)
|
||||
, mReferrer(aOther.mReferrer)
|
||||
, mReferrerPolicy(aOther.mReferrerPolicy)
|
||||
, mMode(aOther.mMode)
|
||||
, mCredentialsMode(aOther.mCredentialsMode)
|
||||
, mResponseTainting(aOther.mResponseTainting)
|
||||
@@ -91,6 +96,7 @@ InternalRequest::InternalRequest(const InternalRequest& aOther)
|
||||
, mUnsafeRequest(aOther.mUnsafeRequest)
|
||||
, mUseURLCredentials(aOther.mUseURLCredentials)
|
||||
, mCreatedByFetchEvent(aOther.mCreatedByFetchEvent)
|
||||
, mContentPolicyTypeOverridden(aOther.mContentPolicyTypeOverridden)
|
||||
{
|
||||
// NOTE: does not copy body stream... use the fallible Clone() for that
|
||||
}
|
||||
@@ -105,6 +111,13 @@ InternalRequest::SetContentPolicyType(nsContentPolicyType aContentPolicyType)
|
||||
mContentPolicyType = aContentPolicyType;
|
||||
}
|
||||
|
||||
void
|
||||
InternalRequest::OverrideContentPolicyType(nsContentPolicyType aContentPolicyType)
|
||||
{
|
||||
SetContentPolicyType(aContentPolicyType);
|
||||
mContentPolicyTypeOverridden = true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
RequestContext
|
||||
InternalRequest::MapContentPolicyTypeToRequestContext(nsContentPolicyType aContentPolicyType)
|
||||
@@ -361,5 +374,14 @@ InternalRequest::MapChannelToRequestCredentials(nsIChannel* aChannel)
|
||||
return RequestCredentials::Same_origin;
|
||||
}
|
||||
|
||||
void
|
||||
InternalRequest::MaybeSkipCacheIfPerformingRevalidation()
|
||||
{
|
||||
if (mCacheMode == RequestCache::Default &&
|
||||
mHeaders->HasRevalidationHeaders()) {
|
||||
mCacheMode = RequestCache::No_store;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -93,6 +93,7 @@ public:
|
||||
, mHeaders(new InternalHeaders(HeadersGuardEnum::None))
|
||||
, mContentPolicyType(nsIContentPolicy::TYPE_FETCH)
|
||||
, mReferrer(NS_LITERAL_STRING(kFETCH_CLIENT_REFERRER_STR))
|
||||
, mReferrerPolicy(ReferrerPolicy::_empty)
|
||||
, mMode(RequestMode::No_cors)
|
||||
, mCredentialsMode(RequestCredentials::Omit)
|
||||
, mResponseTainting(LoadTainting::Basic)
|
||||
@@ -121,12 +122,14 @@ public:
|
||||
RequestRedirect aRequestRedirect,
|
||||
RequestCredentials aRequestCredentials,
|
||||
const nsAString& aReferrer,
|
||||
ReferrerPolicy aReferrerPolicy,
|
||||
nsContentPolicyType aContentPolicyType)
|
||||
: mMethod(aMethod)
|
||||
, mURL(aURL)
|
||||
, mHeaders(aHeaders)
|
||||
, mContentPolicyType(aContentPolicyType)
|
||||
, mReferrer(aReferrer)
|
||||
, mReferrerPolicy(aReferrerPolicy)
|
||||
, mMode(aMode)
|
||||
, mCredentialsMode(aRequestCredentials)
|
||||
, mResponseTainting(LoadTainting::Basic)
|
||||
@@ -142,6 +145,12 @@ public:
|
||||
, mUnsafeRequest(false)
|
||||
, mUseURLCredentials(false)
|
||||
{
|
||||
// Normally we strip the fragment from the URL in Request::Constructor.
|
||||
// If internal code is directly constructing this object they must
|
||||
// strip the fragment first. Since these should be well formed URLs we
|
||||
// can use a simple check for a fragment here. The full parser is
|
||||
// difficult to use off the main thread.
|
||||
MOZ_ASSERT(mURL.Find(NS_LITERAL_CSTRING("#")) == kNotFound);
|
||||
}
|
||||
|
||||
already_AddRefed<InternalRequest> Clone();
|
||||
@@ -225,6 +234,18 @@ public:
|
||||
mReferrer.Assign(aReferrer);
|
||||
}
|
||||
|
||||
ReferrerPolicy
|
||||
ReferrerPolicy_() const
|
||||
{
|
||||
return mReferrerPolicy;
|
||||
}
|
||||
|
||||
void
|
||||
SetReferrerPolicy(ReferrerPolicy aReferrerPolicy)
|
||||
{
|
||||
mReferrerPolicy = aReferrerPolicy;
|
||||
}
|
||||
|
||||
bool
|
||||
SkipServiceWorker() const
|
||||
{
|
||||
@@ -314,6 +335,9 @@ public:
|
||||
void
|
||||
SetContentPolicyType(nsContentPolicyType aContentPolicyType);
|
||||
|
||||
void
|
||||
OverrideContentPolicyType(nsContentPolicyType aContentPolicyType);
|
||||
|
||||
RequestContext
|
||||
Context() const
|
||||
{
|
||||
@@ -404,6 +428,15 @@ public:
|
||||
bool
|
||||
IsClientRequest() const;
|
||||
|
||||
void
|
||||
MaybeSkipCacheIfPerformingRevalidation();
|
||||
|
||||
bool
|
||||
IsContentPolicyTypeOverridden() const
|
||||
{
|
||||
return mContentPolicyTypeOverridden;
|
||||
}
|
||||
|
||||
static RequestMode
|
||||
MapChannelToRequestMode(nsIChannel* aChannel);
|
||||
|
||||
@@ -437,6 +470,7 @@ private:
|
||||
// "about:client": client (default)
|
||||
// URL: an URL
|
||||
nsString mReferrer;
|
||||
ReferrerPolicy mReferrerPolicy;
|
||||
|
||||
RequestMode mMode;
|
||||
RequestCredentials mCredentialsMode;
|
||||
@@ -456,6 +490,10 @@ private:
|
||||
// use it to check if Service Workers are simply fetching intercepted Request
|
||||
// objects without modifying them.
|
||||
bool mCreatedByFetchEvent = false;
|
||||
// This is only set when Request.overrideContentPolicyType() has been set.
|
||||
// It is illegal to pass such a Request object to a fetch() method unless
|
||||
// if the caller has chrome privileges.
|
||||
bool mContentPolicyTypeOverridden = false;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
+179
-37
@@ -91,9 +91,9 @@ Request::GetInternalRequest()
|
||||
}
|
||||
|
||||
namespace {
|
||||
void
|
||||
GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
|
||||
nsAString& aRequestURL, ErrorResult& aRv)
|
||||
already_AddRefed<nsIURI>
|
||||
ParseURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(aDocument);
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@@ -103,6 +103,16 @@ GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
|
||||
aRv = NS_NewURI(getter_AddRefs(resolvedURI), aInput, nullptr, baseURI);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(aInput);
|
||||
}
|
||||
return resolvedURI.forget();
|
||||
}
|
||||
|
||||
void
|
||||
GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
|
||||
nsAString& aRequestURL, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIURI> resolvedURI = ParseURLFromDocument(aDocument, aInput, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -132,9 +142,8 @@ GetRequestURLFromDocument(nsIDocument* aDocument, const nsAString& aInput,
|
||||
CopyUTF8toUTF16(spec, aRequestURL);
|
||||
}
|
||||
|
||||
void
|
||||
GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
|
||||
ErrorResult& aRv)
|
||||
already_AddRefed<nsIURI>
|
||||
ParseURLFromChrome(const nsAString& aInput, ErrorResult& aRv)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@@ -142,6 +151,16 @@ GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
|
||||
aRv = NS_NewURI(getter_AddRefs(uri), aInput, nullptr, nullptr);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(aInput);
|
||||
}
|
||||
return uri.forget();
|
||||
}
|
||||
|
||||
void
|
||||
GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = ParseURLFromChrome(aInput, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -171,9 +190,9 @@ GetRequestURLFromChrome(const nsAString& aInput, nsAString& aRequestURL,
|
||||
CopyUTF8toUTF16(spec, aRequestURL);
|
||||
}
|
||||
|
||||
void
|
||||
GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
nsAString& aRequestURL, ErrorResult& aRv)
|
||||
already_AddRefed<workers::URL>
|
||||
ParseURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(worker);
|
||||
@@ -184,6 +203,16 @@ GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
workers::URL::Constructor(aGlobal, aInput, baseURL, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_URL>(aInput);
|
||||
}
|
||||
return url.forget();
|
||||
}
|
||||
|
||||
void
|
||||
GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
nsAString& aRequestURL, ErrorResult& aRv)
|
||||
{
|
||||
RefPtr<workers::URL> url = ParseURLFromWorker(aGlobal, aInput, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -215,6 +244,38 @@ GetRequestURLFromWorker(const GlobalObject& aGlobal, const nsAString& aInput,
|
||||
}
|
||||
}
|
||||
|
||||
class ReferrerSameOriginChecker final : public workers::WorkerMainThreadRunnable
|
||||
{
|
||||
public:
|
||||
ReferrerSameOriginChecker(workers::WorkerPrivate* aWorkerPrivate,
|
||||
const nsAString& aReferrerURL,
|
||||
nsresult& aResult)
|
||||
: workers::WorkerMainThreadRunnable(aWorkerPrivate),
|
||||
mReferrerURL(aReferrerURL),
|
||||
mResult(aResult)
|
||||
{
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
}
|
||||
|
||||
bool
|
||||
MainThreadRun() override
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (NS_SUCCEEDED(NS_NewURI(getter_AddRefs(uri), mReferrerURL))) {
|
||||
nsCOMPtr<nsIPrincipal> principal = mWorkerPrivate->GetPrincipal();
|
||||
if (principal) {
|
||||
mResult = principal->CheckMayLoad(uri, /* report */ false,
|
||||
/* allowIfInheritsPrincipal */ false);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
const nsString mReferrerURL;
|
||||
nsresult& mResult;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
/*static*/ already_AddRefed<Request>
|
||||
@@ -231,15 +292,16 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
RefPtr<Request> inputReq = &aInput.GetAsRequest();
|
||||
nsCOMPtr<nsIInputStream> body;
|
||||
inputReq->GetBody(getter_AddRefs(body));
|
||||
if (inputReq->BodyUsed()) {
|
||||
aRv.ThrowTypeError<MSG_FETCH_BODY_CONSUMED_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
if (body) {
|
||||
if (inputReq->BodyUsed()) {
|
||||
aRv.ThrowTypeError<MSG_FETCH_BODY_CONSUMED_ERROR>();
|
||||
return nullptr;
|
||||
}
|
||||
temporaryBody = body;
|
||||
}
|
||||
|
||||
request = inputReq->GetInternalRequest();
|
||||
|
||||
} else {
|
||||
request = new InternalRequest();
|
||||
}
|
||||
@@ -284,11 +346,85 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
aInit.mCredentials.WasPassed() ? aInit.mCredentials.Value()
|
||||
: fallbackCredentials;
|
||||
|
||||
if (mode == RequestMode::Navigate) {
|
||||
if (mode == RequestMode::Navigate ||
|
||||
(aInit.IsAnyMemberPresent() && request->Mode() == RequestMode::Navigate)) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_REQUEST_MODE>(NS_LITERAL_STRING("navigate"));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aInit.IsAnyMemberPresent()) {
|
||||
request->SetReferrer(NS_LITERAL_STRING(kFETCH_CLIENT_REFERRER_STR));
|
||||
request->SetReferrerPolicy(ReferrerPolicy::_empty);
|
||||
}
|
||||
if (aInit.mReferrer.WasPassed()) {
|
||||
const nsString& referrer = aInit.mReferrer.Value();
|
||||
if (referrer.IsEmpty()) {
|
||||
request->SetReferrer(NS_LITERAL_STRING(""));
|
||||
} else {
|
||||
nsAutoString referrerURL;
|
||||
if (NS_IsMainThread()) {
|
||||
nsIDocument* doc = GetEntryDocument();
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
if (doc) {
|
||||
uri = ParseURLFromDocument(doc, referrer, aRv);
|
||||
} else {
|
||||
// If we don't have a document, we must assume that this is a full URL.
|
||||
uri = ParseURLFromChrome(referrer, aRv);
|
||||
}
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
|
||||
return nullptr;
|
||||
}
|
||||
nsAutoCString spec;
|
||||
uri->GetSpec(spec);
|
||||
CopyUTF8toUTF16(spec, referrerURL);
|
||||
if (!referrerURL.EqualsLiteral(kFETCH_CLIENT_REFERRER_STR)) {
|
||||
nsCOMPtr<nsIPrincipal> principal = global->PrincipalOrNull();
|
||||
if (principal) {
|
||||
nsresult rv = principal->CheckMayLoad(uri, /* report */ false,
|
||||
/* allowIfInheritsPrincipal */ false);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
RefPtr<workers::URL> url = ParseURLFromWorker(aGlobal, referrer, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
|
||||
return nullptr;
|
||||
}
|
||||
url->Stringify(referrerURL, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
|
||||
return nullptr;
|
||||
}
|
||||
if (!referrerURL.EqualsLiteral(kFETCH_CLIENT_REFERRER_STR)) {
|
||||
workers::WorkerPrivate* worker = workers::GetCurrentThreadWorkerPrivate();
|
||||
nsresult rv = NS_OK;
|
||||
// ReferrerSameOriginChecker uses a sync loop to get the main thread
|
||||
// to perform the same-origin check. Overall, on Workers this method
|
||||
// can create 3 sync loops (two for constructing URLs and one here) so
|
||||
// in the future we may want to optimize it all by off-loading all of
|
||||
// this work in a single sync loop.
|
||||
RefPtr<ReferrerSameOriginChecker> checker =
|
||||
new ReferrerSameOriginChecker(worker, referrerURL, rv);
|
||||
checker->Dispatch(aRv);
|
||||
if (aRv.Failed() || NS_FAILED(rv)) {
|
||||
aRv.ThrowTypeError<MSG_INVALID_REFERRER_URL>(referrer);
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
request->SetReferrer(referrerURL);
|
||||
}
|
||||
}
|
||||
|
||||
if (aInit.mReferrerPolicy.WasPassed()) {
|
||||
request->SetReferrerPolicy(aInit.mReferrerPolicy.Value());
|
||||
}
|
||||
|
||||
if (mode != RequestMode::EndGuard_) {
|
||||
request->ClearCreatedByFetchEvent();
|
||||
request->SetMode(mode);
|
||||
@@ -370,7 +506,8 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (aInit.mBody.WasPassed() || temporaryBody) {
|
||||
if ((aInit.mBody.WasPassed() && !aInit.mBody.Value().IsNull()) ||
|
||||
temporaryBody) {
|
||||
// HEAD and GET are not allowed to have a body.
|
||||
nsAutoCString method;
|
||||
request->GetMethod(method);
|
||||
@@ -382,29 +519,34 @@ Request::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
if (aInit.mBody.WasPassed()) {
|
||||
const OwningArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams& bodyInit = aInit.mBody.Value();
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
nsAutoCString contentType;
|
||||
aRv = ExtractByteStreamFromBody(bodyInit,
|
||||
getter_AddRefs(stream), contentType);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
const Nullable<OwningArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams>& bodyInitNullable =
|
||||
aInit.mBody.Value();
|
||||
if (!bodyInitNullable.IsNull()) {
|
||||
const OwningArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams& bodyInit =
|
||||
bodyInitNullable.Value();
|
||||
nsCOMPtr<nsIInputStream> stream;
|
||||
nsAutoCString contentType;
|
||||
aRv = ExtractByteStreamFromBody(bodyInit,
|
||||
getter_AddRefs(stream), contentType);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
temporaryBody = stream;
|
||||
|
||||
if (!contentType.IsVoid() &&
|
||||
!requestHeaders->Has(NS_LITERAL_CSTRING("Content-Type"), aRv)) {
|
||||
requestHeaders->Append(NS_LITERAL_CSTRING("Content-Type"),
|
||||
contentType, aRv);
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
request->ClearCreatedByFetchEvent();
|
||||
request->SetBody(temporaryBody);
|
||||
}
|
||||
|
||||
temporaryBody = stream;
|
||||
|
||||
if (!contentType.IsVoid() &&
|
||||
!requestHeaders->Has(NS_LITERAL_CSTRING("Content-Type"), aRv)) {
|
||||
requestHeaders->Append(NS_LITERAL_CSTRING("Content-Type"),
|
||||
contentType, aRv);
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
request->ClearCreatedByFetchEvent();
|
||||
request->SetBody(temporaryBody);
|
||||
}
|
||||
|
||||
RefPtr<Request> domRequest = new Request(global, request);
|
||||
|
||||
+14
-2
@@ -88,9 +88,15 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
SetContentPolicyType(nsContentPolicyType aContentPolicyType)
|
||||
OverrideContentPolicyType(nsContentPolicyType aContentPolicyType)
|
||||
{
|
||||
mRequest->SetContentPolicyType(aContentPolicyType);
|
||||
mRequest->OverrideContentPolicyType(aContentPolicyType);
|
||||
}
|
||||
|
||||
bool
|
||||
IsContentPolicyTypeOverridden() const
|
||||
{
|
||||
return mRequest->IsContentPolicyTypeOverridden();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -99,6 +105,12 @@ public:
|
||||
mRequest->GetReferrer(aReferrer);
|
||||
}
|
||||
|
||||
ReferrerPolicy
|
||||
ReferrerPolicy_() const
|
||||
{
|
||||
return mRequest->ReferrerPolicy_();
|
||||
}
|
||||
|
||||
InternalHeaders*
|
||||
GetInternalHeaders() const
|
||||
{
|
||||
|
||||
@@ -183,13 +183,14 @@ FileSystemResponseValue
|
||||
CreateFileTask::GetSuccessRequestResult(ErrorResult& aRv) const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
|
||||
BlobParent* actor = GetBlobParent(mTargetBlobImpl);
|
||||
if (!actor) {
|
||||
return FileSystemErrorResponse(NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR);
|
||||
|
||||
nsAutoString path;
|
||||
aRv = mTargetPath->GetPath(path);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return FileSystemDirectoryResponse();
|
||||
}
|
||||
FileSystemFileResponse response;
|
||||
response.blobParent() = actor;
|
||||
return response;
|
||||
|
||||
return FileSystemFileResponse(path);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -198,8 +199,12 @@ CreateFileTask::SetSuccessRequestResult(const FileSystemResponseValue& aValue,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
|
||||
FileSystemFileResponse r = aValue;
|
||||
BlobChild* actor = static_cast<BlobChild*>(r.blobChild());
|
||||
mTargetBlobImpl = actor->GetBlobImpl();
|
||||
|
||||
NS_ConvertUTF16toUTF8 path(r.realPath());
|
||||
aRv = NS_NewNativeLocalFile(path, true, getter_AddRefs(mTargetPath));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -312,7 +317,6 @@ CreateFileTask::Work()
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mTargetBlobImpl = new BlobImplFile(mTargetPath);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -331,7 +335,6 @@ CreateFileTask::Work()
|
||||
return NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR;
|
||||
}
|
||||
|
||||
mTargetBlobImpl = new BlobImplFile(mTargetPath);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -352,9 +355,9 @@ CreateFileTask::HandlerCallback()
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Blob> blob = Blob::Create(mFileSystem->GetParentObject(),
|
||||
mTargetBlobImpl);
|
||||
mPromise->MaybeResolve(blob);
|
||||
RefPtr<File> file = File::CreateFromFile(mFileSystem->GetParentObject(),
|
||||
mTargetPath);
|
||||
mPromise->MaybeResolve(file);
|
||||
mPromise = nullptr;
|
||||
mBlobData = nullptr;
|
||||
}
|
||||
|
||||
@@ -86,10 +86,6 @@ private:
|
||||
nsCOMPtr<nsIInputStream> mBlobStream;
|
||||
InfallibleTArray<uint8_t> mArrayData;
|
||||
bool mReplace;
|
||||
|
||||
// This cannot be a File because this object is created on a different
|
||||
// thread and File is not thread-safe. Let's use the BlobImpl instead.
|
||||
RefPtr<BlobImpl> mTargetBlobImpl;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -44,7 +44,7 @@ DeviceStorageFileSystem::DeviceStorageFileSystem(const nsAString& aStorageType,
|
||||
aStorageName,
|
||||
getter_AddRefs(rootFile));
|
||||
|
||||
NS_WARN_IF(!rootFile || NS_FAILED(rootFile->GetPath(mLocalRootPath)));
|
||||
NS_WARN_IF(!rootFile || NS_FAILED(rootFile->GetPath(mLocalOrDeviceStorageRootPath)));
|
||||
|
||||
if (!XRE_IsParentProcess()) {
|
||||
return;
|
||||
@@ -113,7 +113,7 @@ DeviceStorageFileSystem::IsSafeFile(nsIFile* aFile) const
|
||||
MOZ_ASSERT(aFile);
|
||||
|
||||
nsCOMPtr<nsIFile> rootPath;
|
||||
nsresult rv = NS_NewLocalFile(GetLocalRootPath(), false,
|
||||
nsresult rv = NS_NewLocalFile(LocalOrDeviceStorageRootPath(), false,
|
||||
getter_AddRefs(rootPath));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
|
||||
@@ -118,7 +118,7 @@ Directory::GetRoot(FileSystemBase* aFileSystem, ErrorResult& aRv)
|
||||
MOZ_ASSERT(aFileSystem);
|
||||
|
||||
nsCOMPtr<nsIFile> path;
|
||||
aRv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(aFileSystem->GetLocalRootPath()),
|
||||
aRv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(aFileSystem->LocalOrDeviceStorageRootPath()),
|
||||
true, getter_AddRefs(path));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
@@ -146,6 +146,13 @@ Directory::Create(nsISupports* aParent, nsIFile* aFile,
|
||||
bool isDir;
|
||||
nsresult rv = aFile->IsDirectory(&isDir);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv) && isDir);
|
||||
|
||||
if (aType == eNotDOMRootDirectory) {
|
||||
RefPtr<nsIFile> parent;
|
||||
rv = aFile->GetParent(getter_AddRefs(parent));
|
||||
// We must have a parent if this is not the root directory.
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv) && parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
RefPtr<Directory> directory =
|
||||
@@ -319,7 +326,6 @@ Directory::RemoveInternal(const StringOrFileOrDirectory& aPath, bool aRecursive,
|
||||
{
|
||||
nsresult error = NS_OK;
|
||||
nsCOMPtr<nsIFile> realPath;
|
||||
RefPtr<BlobImpl> blob;
|
||||
|
||||
// Check and get the target path.
|
||||
|
||||
@@ -328,25 +334,38 @@ Directory::RemoveInternal(const StringOrFileOrDirectory& aPath, bool aRecursive,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If this is a File
|
||||
if (aPath.IsFile()) {
|
||||
blob = aPath.GetAsFile().Impl();
|
||||
if (!fs->GetRealPath(aPath.GetAsFile().Impl(),
|
||||
getter_AddRefs(realPath))) {
|
||||
error = NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
// If this is a string
|
||||
} else if (aPath.IsString()) {
|
||||
error = DOMPathToRealPath(aPath.GetAsString(), getter_AddRefs(realPath));
|
||||
} else if (!fs->IsSafeDirectory(&aPath.GetAsDirectory())) {
|
||||
error = NS_ERROR_DOM_SECURITY_ERR;
|
||||
|
||||
// Directory
|
||||
} else {
|
||||
realPath = aPath.GetAsDirectory().mFile;
|
||||
// The target must be a descendant of this directory.
|
||||
if (!FileSystemUtils::IsDescendantPath(mFile, realPath)) {
|
||||
error = NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
MOZ_ASSERT(aPath.IsDirectory());
|
||||
if (!fs->IsSafeDirectory(&aPath.GetAsDirectory())) {
|
||||
error = NS_ERROR_DOM_SECURITY_ERR;
|
||||
} else {
|
||||
realPath = aPath.GetAsDirectory().mFile;
|
||||
}
|
||||
}
|
||||
|
||||
// The target must be a descendant of this directory.
|
||||
if (!FileSystemUtils::IsDescendantPath(mFile, realPath)) {
|
||||
error = NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
RefPtr<RemoveTask> task =
|
||||
RemoveTask::Create(fs, mFile, blob, realPath, aRecursive, aRv);
|
||||
RemoveTask::Create(fs, mFile, realPath, aRecursive, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
task->SetError(error);
|
||||
FileSystemPermissionRequest::RequestForTask(task);
|
||||
return task->GetPromise();
|
||||
@@ -355,12 +374,20 @@ Directory::RemoveInternal(const StringOrFileOrDirectory& aPath, bool aRecursive,
|
||||
void
|
||||
Directory::GetPath(nsAString& aRetval, ErrorResult& aRv)
|
||||
{
|
||||
if (mType == eDOMRootDirectory) {
|
||||
aRetval.AssignLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL);
|
||||
} else {
|
||||
// TODO: this should be a bit different...
|
||||
GetName(aRetval, aRv);
|
||||
// This operation is expensive. Better to cache the result.
|
||||
if (mPath.IsEmpty()) {
|
||||
RefPtr<FileSystemBase> fs = GetFileSystem(aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
fs->GetDOMPath(mFile, mType, mPath, aRv);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
aRetval = mPath;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -402,19 +429,12 @@ FileSystemBase*
|
||||
Directory::GetFileSystem(ErrorResult& aRv)
|
||||
{
|
||||
if (!mFileSystem) {
|
||||
nsCOMPtr<nsIFile> parent;
|
||||
aRv = mFile->GetParent(getter_AddRefs(parent));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Parent can be null if mFile is pointing to the top directory.
|
||||
if (!parent) {
|
||||
parent = mFile;
|
||||
}
|
||||
// Any subdir inherits the FileSystem of the parent Directory. If we are
|
||||
// here it's because we are dealing with the DOM root.
|
||||
MOZ_ASSERT(mType == eDOMRootDirectory);
|
||||
|
||||
nsAutoString path;
|
||||
aRv = parent->GetPath(path);
|
||||
aRv = mFile->GetPath(path);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -40,13 +40,12 @@ class Directory final
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
struct BlobImplOrDirectoryPath
|
||||
struct FileOrDirectoryPath
|
||||
{
|
||||
RefPtr<BlobImpl> mBlobImpl;
|
||||
nsString mDirectoryPath;
|
||||
nsString mPath;
|
||||
|
||||
enum {
|
||||
eBlobImpl,
|
||||
eFilePath,
|
||||
eDirectoryPath
|
||||
} mType;
|
||||
};
|
||||
@@ -167,6 +166,7 @@ private:
|
||||
DirectoryType mType;
|
||||
|
||||
nsString mFilters;
|
||||
nsString mPath;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -67,9 +67,8 @@ FileSystemBase::GetParentObject() const
|
||||
bool
|
||||
FileSystemBase::GetRealPath(BlobImpl* aFile, nsIFile** aPath) const
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsParentProcess(),
|
||||
"Should be on parent process!");
|
||||
MOZ_ASSERT(aFile, "aFile Should not be null.");
|
||||
MOZ_ASSERT(aPath);
|
||||
|
||||
nsAutoString filePath;
|
||||
ErrorResult rv;
|
||||
@@ -99,5 +98,78 @@ FileSystemBase::IsSafeDirectory(Directory* aDir) const
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
FileSystemBase::GetDOMPath(nsIFile* aFile,
|
||||
Directory::DirectoryType aType,
|
||||
nsAString& aRetval,
|
||||
ErrorResult& aRv) const
|
||||
{
|
||||
MOZ_ASSERT(aFile);
|
||||
|
||||
if (aType == Directory::eDOMRootDirectory) {
|
||||
aRetval.AssignLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL);
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> fileSystemPath;
|
||||
aRv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(LocalOrDeviceStorageRootPath()),
|
||||
true, getter_AddRefs(fileSystemPath));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(FileSystemUtils::IsDescendantPath(fileSystemPath, aFile));
|
||||
|
||||
nsCOMPtr<nsIFile> path;
|
||||
aRv = aFile->Clone(getter_AddRefs(path));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsTArray<nsString> parts;
|
||||
|
||||
while (true) {
|
||||
bool equal = false;
|
||||
aRv = fileSystemPath->Equals(path, &equal);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (equal) {
|
||||
break;
|
||||
}
|
||||
|
||||
nsAutoString leafName;
|
||||
aRv = path->GetLeafName(leafName);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
parts.AppendElement(leafName);
|
||||
|
||||
nsCOMPtr<nsIFile> parentPath;
|
||||
aRv = path->GetParent(getter_AddRefs(parentPath));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(parentPath);
|
||||
|
||||
aRv = parentPath->Clone(getter_AddRefs(path));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!parts.IsEmpty());
|
||||
|
||||
aRetval.Truncate();
|
||||
|
||||
for (int32_t i = parts.Length() - 1; i >= 0; --i) {
|
||||
aRetval.AppendLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL);
|
||||
aRetval.Append(parts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "Directory.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class BlobImpl;
|
||||
class Directory;
|
||||
|
||||
class FileSystemBase
|
||||
{
|
||||
@@ -47,10 +47,20 @@ public:
|
||||
virtual void
|
||||
GetRootName(nsAString& aRetval) const = 0;
|
||||
|
||||
void
|
||||
GetDOMPath(nsIFile* aFile, Directory::DirectoryType aType,
|
||||
nsAString& aRetval, ErrorResult& aRv) const;
|
||||
|
||||
/*
|
||||
* Return the local root path of the FileSystem implementation.
|
||||
* For OSFileSystem, this is equal to the path of the root Directory;
|
||||
* For DeviceStorageFileSystem, this is the path of the SDCard, parent
|
||||
* directory of the exposed root Directory (per type).
|
||||
*/
|
||||
const nsAString&
|
||||
GetLocalRootPath() const
|
||||
LocalOrDeviceStorageRootPath() const
|
||||
{
|
||||
return mLocalRootPath;
|
||||
return mLocalOrDeviceStorageRootPath;
|
||||
}
|
||||
|
||||
bool
|
||||
@@ -92,9 +102,17 @@ protected:
|
||||
|
||||
// The local path of the root (i.e. the OS path, with OS path separators, of
|
||||
// the OS directory that acts as the root of this OSFileSystem).
|
||||
// Only available in the parent process.
|
||||
// In the child process, we don't use it and its value should be empty.
|
||||
nsString mLocalRootPath;
|
||||
// This path must be set by the FileSystem implementation immediately
|
||||
// because it will be used for the validation of any FileSystemTaskBase.
|
||||
// The concept of this path is that, any task will never go out of it and this
|
||||
// must be considered the OS 'root' of the current FileSystem. Different
|
||||
// Directory object can have different OS 'root' path.
|
||||
// To be more clear, any path managed by this FileSystem implementation must
|
||||
// be discendant of this local root path.
|
||||
// The reason why it's not just called 'localRootPath' is because for
|
||||
// DeviceStorage this contains the path of the device storage SDCard, that is
|
||||
// the parent directory of the exposed root path.
|
||||
nsString mLocalOrDeviceStorageRootPath;
|
||||
|
||||
bool mShutdown;
|
||||
|
||||
|
||||
@@ -201,36 +201,6 @@ FileSystemTaskBase::Recv__delete__(const FileSystemResponseValue& aValue)
|
||||
return true;
|
||||
}
|
||||
|
||||
BlobParent*
|
||||
FileSystemTaskBase::GetBlobParent(BlobImpl* aFile) const
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsParentProcess(),
|
||||
"Only call from parent process!");
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
|
||||
MOZ_ASSERT(aFile);
|
||||
|
||||
// Load the lazy dom file data from the parent before sending to the child.
|
||||
nsString mimeType;
|
||||
aFile->GetType(mimeType);
|
||||
|
||||
// We call GetSize and GetLastModified to prepopulate the value in the
|
||||
// BlobImpl.
|
||||
{
|
||||
ErrorResult rv;
|
||||
aFile->GetSize(rv);
|
||||
rv.SuppressException();
|
||||
}
|
||||
|
||||
{
|
||||
ErrorResult rv;
|
||||
aFile->GetLastModified(rv);
|
||||
rv.SuppressException();
|
||||
}
|
||||
|
||||
ContentParent* cp = static_cast<ContentParent*>(mRequestParent->Manager());
|
||||
return cp->GetOrCreateActorForBlobImpl(aFile);
|
||||
}
|
||||
|
||||
void
|
||||
FileSystemTaskBase::SetError(const nsresult& aErrorValue)
|
||||
{
|
||||
|
||||
@@ -205,9 +205,6 @@ protected:
|
||||
virtual bool
|
||||
Recv__delete__(const FileSystemResponseValue& value) override;
|
||||
|
||||
BlobParent*
|
||||
GetBlobParent(BlobImpl* aBlob) const;
|
||||
|
||||
nsresult mErrorValue;
|
||||
|
||||
RefPtr<FileSystemBase> mFileSystem;
|
||||
|
||||
@@ -138,19 +138,14 @@ GetDirectoryListingTask::GetSuccessRequestResult(ErrorResult& aRv) const
|
||||
nsTArray<FileSystemDirectoryListingResponseData> inputs;
|
||||
|
||||
for (unsigned i = 0; i < mTargetData.Length(); i++) {
|
||||
if (mTargetData[i].mType == Directory::BlobImplOrDirectoryPath::eBlobImpl) {
|
||||
BlobParent* blobParent = GetBlobParent(mTargetData[i].mBlobImpl);
|
||||
if (!blobParent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FileSystemDirectoryListingResponseBlob blobData;
|
||||
blobData.blobParent() = blobParent;
|
||||
inputs.AppendElement(blobData);
|
||||
if (mTargetData[i].mType == Directory::FileOrDirectoryPath::eFilePath) {
|
||||
FileSystemDirectoryListingResponseFile fileData;
|
||||
fileData.fileRealPath() = mTargetData[i].mPath;
|
||||
inputs.AppendElement(fileData);
|
||||
} else {
|
||||
MOZ_ASSERT(mTargetData[i].mType == Directory::BlobImplOrDirectoryPath::eDirectoryPath);
|
||||
MOZ_ASSERT(mTargetData[i].mType == Directory::FileOrDirectoryPath::eDirectoryPath);
|
||||
FileSystemDirectoryListingResponseDirectory directoryData;
|
||||
directoryData.directoryRealPath() = mTargetData[i].mDirectoryPath;
|
||||
directoryData.directoryRealPath() = mTargetData[i].mPath;
|
||||
inputs.AppendElement(directoryData);
|
||||
}
|
||||
}
|
||||
@@ -172,18 +167,21 @@ GetDirectoryListingTask::SetSuccessRequestResult(const FileSystemResponseValue&
|
||||
for (uint32_t i = 0; i < r.data().Length(); ++i) {
|
||||
const FileSystemDirectoryListingResponseData& data = r.data()[i];
|
||||
|
||||
if (data.type() == FileSystemDirectoryListingResponseData::TFileSystemDirectoryListingResponseBlob) {
|
||||
PBlobChild* blob = data.get_FileSystemDirectoryListingResponseBlob().blobChild();
|
||||
Directory::FileOrDirectoryPath element;
|
||||
|
||||
Directory::BlobImplOrDirectoryPath* element = mTargetData.AppendElement();
|
||||
element->mType = Directory::BlobImplOrDirectoryPath::eBlobImpl;
|
||||
element->mBlobImpl = static_cast<BlobChild*>(blob)->GetBlobImpl();
|
||||
if (data.type() == FileSystemDirectoryListingResponseData::TFileSystemDirectoryListingResponseFile) {
|
||||
element.mType = Directory::FileOrDirectoryPath::eFilePath;
|
||||
element.mPath = data.get_FileSystemDirectoryListingResponseFile().fileRealPath();
|
||||
} else {
|
||||
MOZ_ASSERT(data.type() == FileSystemDirectoryListingResponseData::TFileSystemDirectoryListingResponseDirectory);
|
||||
|
||||
Directory::BlobImplOrDirectoryPath* element = mTargetData.AppendElement();
|
||||
element->mType = Directory::BlobImplOrDirectoryPath::eDirectoryPath;
|
||||
element->mDirectoryPath = data.get_FileSystemDirectoryListingResponseDirectory().directoryRealPath();
|
||||
element.mType = Directory::FileOrDirectoryPath::eDirectoryPath;
|
||||
element.mPath = data.get_FileSystemDirectoryListingResponseDirectory().directoryRealPath();
|
||||
}
|
||||
|
||||
if (!mTargetData.AppendElement(element, fallible)) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,21 +285,18 @@ GetDirectoryListingTask::Work()
|
||||
}
|
||||
}
|
||||
|
||||
if (isDir) {
|
||||
nsAutoString path;
|
||||
if (NS_WARN_IF(NS_FAILED(currFile->GetPath(path)))) {
|
||||
continue;
|
||||
}
|
||||
nsAutoString path;
|
||||
if (NS_WARN_IF(NS_FAILED(currFile->GetPath(path)))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Directory::BlobImplOrDirectoryPath* element = mTargetData.AppendElement();
|
||||
element->mType = Directory::BlobImplOrDirectoryPath::eDirectoryPath;
|
||||
element->mDirectoryPath = path;
|
||||
} else {
|
||||
BlobImplFile* impl = new BlobImplFile(currFile);
|
||||
Directory::FileOrDirectoryPath element;
|
||||
element.mPath = path;
|
||||
element.mType = isDir ? Directory::FileOrDirectoryPath::eDirectoryPath
|
||||
: Directory::FileOrDirectoryPath::eFilePath;
|
||||
|
||||
Directory::BlobImplOrDirectoryPath* element = mTargetData.AppendElement();
|
||||
element->mType = Directory::BlobImplOrDirectoryPath::eBlobImpl;
|
||||
element->mBlobImpl = impl;
|
||||
if (!mTargetData.AppendElement(element, fallible)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
@@ -333,44 +328,45 @@ GetDirectoryListingTask::HandlerCallback()
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < count; i++) {
|
||||
if (mTargetData[i].mType == Directory::BlobImplOrDirectoryPath::eDirectoryPath) {
|
||||
nsCOMPtr<nsIFile> directoryPath;
|
||||
NS_ConvertUTF16toUTF8 path(mTargetData[i].mDirectoryPath);
|
||||
nsresult rv = NS_NewNativeLocalFile(path, true,
|
||||
getter_AddRefs(directoryPath));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
mPromise->MaybeReject(rv);
|
||||
mPromise = nullptr;
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIFile> path;
|
||||
NS_ConvertUTF16toUTF8 fullPath(mTargetData[i].mPath);
|
||||
nsresult rv = NS_NewNativeLocalFile(fullPath, true, getter_AddRefs(path));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
mPromise->MaybeReject(rv);
|
||||
mPromise = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIFile> rootPath;
|
||||
rv = NS_NewLocalFile(mFileSystem->GetLocalRootPath(), false,
|
||||
getter_AddRefs(rootPath));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
mPromise->MaybeReject(rv);
|
||||
mPromise = nullptr;
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIFile> rootPath;
|
||||
rv = NS_NewLocalFile(mFileSystem->LocalOrDeviceStorageRootPath(), false,
|
||||
getter_AddRefs(rootPath));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
mPromise->MaybeReject(rv);
|
||||
mPromise = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(FileSystemUtils::IsDescendantPath(rootPath, directoryPath));
|
||||
MOZ_ASSERT(FileSystemUtils::IsDescendantPath(rootPath, path));
|
||||
#endif
|
||||
|
||||
if (mTargetData[i].mType == Directory::FileOrDirectoryPath::eDirectoryPath) {
|
||||
RefPtr<Directory> directory =
|
||||
Directory::Create(mFileSystem->GetParentObject(),
|
||||
directoryPath,
|
||||
Directory::eNotDOMRootDirectory,
|
||||
mFileSystem);
|
||||
Directory::Create(mFileSystem->GetParentObject(), path,
|
||||
Directory::eNotDOMRootDirectory, mFileSystem);
|
||||
MOZ_ASSERT(directory);
|
||||
|
||||
// Propogate mFilter onto sub-Directory object:
|
||||
directory->SetContentFilters(mFilters);
|
||||
listing[i].SetAsDirectory() = directory;
|
||||
} else {
|
||||
MOZ_ASSERT(mTargetData[i].mType == Directory::BlobImplOrDirectoryPath::eBlobImpl);
|
||||
listing[i].SetAsFile() =
|
||||
File::Create(mFileSystem->GetParentObject(), mTargetData[i].mBlobImpl);
|
||||
MOZ_ASSERT(mTargetData[i].mType == Directory::FileOrDirectoryPath::eFilePath);
|
||||
|
||||
RefPtr<File> file =
|
||||
File::CreateFromFile(mFileSystem->GetParentObject(), path);
|
||||
MOZ_ASSERT(file);
|
||||
|
||||
listing[i].SetAsFile() = file;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ private:
|
||||
|
||||
// We cannot store File or Directory objects bacause this object is created
|
||||
// on a different thread and File and Directory are not thread-safe.
|
||||
nsTArray<Directory::BlobImplOrDirectoryPath> mTargetData;
|
||||
FallibleTArray<Directory::FileOrDirectoryPath> mTargetData;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -130,23 +130,17 @@ FileSystemResponseValue
|
||||
GetFileOrDirectoryTask::GetSuccessRequestResult(ErrorResult& aRv) const
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
|
||||
if (mIsDirectory) {
|
||||
nsAutoString path;
|
||||
aRv = mTargetPath->GetPath(path);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return FileSystemDirectoryResponse();
|
||||
}
|
||||
nsAutoString path;
|
||||
aRv = mTargetPath->GetPath(path);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return FileSystemDirectoryResponse();
|
||||
}
|
||||
|
||||
if (mIsDirectory) {
|
||||
return FileSystemDirectoryResponse(path);
|
||||
}
|
||||
|
||||
BlobParent* actor = GetBlobParent(mTargetBlobImpl);
|
||||
if (!actor) {
|
||||
return FileSystemErrorResponse(NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR);
|
||||
}
|
||||
FileSystemFileResponse response;
|
||||
response.blobParent() = actor;
|
||||
return response;
|
||||
return FileSystemFileResponse(path);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -157,8 +151,13 @@ GetFileOrDirectoryTask::SetSuccessRequestResult(const FileSystemResponseValue& a
|
||||
switch (aValue.type()) {
|
||||
case FileSystemResponseValue::TFileSystemFileResponse: {
|
||||
FileSystemFileResponse r = aValue;
|
||||
BlobChild* actor = static_cast<BlobChild*>(r.blobChild());
|
||||
mTargetBlobImpl = actor->GetBlobImpl();
|
||||
|
||||
NS_ConvertUTF16toUTF8 path(r.realPath());
|
||||
aRv = NS_NewNativeLocalFile(path, true, getter_AddRefs(mTargetPath));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
mIsDirectory = false;
|
||||
break;
|
||||
}
|
||||
@@ -242,8 +241,6 @@ GetFileOrDirectoryTask::Work()
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
mTargetBlobImpl = new BlobImplFile(mTargetPath);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -274,9 +271,9 @@ GetFileOrDirectoryTask::HandlerCallback()
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Blob> blob = Blob::Create(mFileSystem->GetParentObject(),
|
||||
mTargetBlobImpl);
|
||||
mPromise->MaybeResolve(blob);
|
||||
RefPtr<File> file = File::CreateFromFile(mFileSystem->GetParentObject(),
|
||||
mTargetPath);
|
||||
mPromise->MaybeResolve(file);
|
||||
mPromise = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,10 +76,6 @@ private:
|
||||
// Whether we get a directory.
|
||||
bool mIsDirectory;
|
||||
Directory::DirectoryType mType;
|
||||
|
||||
// This cannot be a File bacause this object is created on a different
|
||||
// thread and File is not thread-safe. Let's use the BlobImpl instead.
|
||||
RefPtr<BlobImpl> mTargetBlobImpl;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace dom {
|
||||
|
||||
OSFileSystem::OSFileSystem(const nsAString& aRootDir)
|
||||
{
|
||||
mLocalRootPath = aRootDir;
|
||||
mLocalOrDeviceStorageRootPath = aRootDir;
|
||||
|
||||
// Non-mobile devices don't have the concept of separate permissions to
|
||||
// access different parts of devices storage like Pictures, or Videos, etc.
|
||||
@@ -33,7 +33,7 @@ OSFileSystem::OSFileSystem(const nsAString& aRootDir)
|
||||
already_AddRefed<FileSystemBase>
|
||||
OSFileSystem::Clone()
|
||||
{
|
||||
RefPtr<OSFileSystem> fs = new OSFileSystem(mLocalRootPath);
|
||||
RefPtr<OSFileSystem> fs = new OSFileSystem(mLocalOrDeviceStorageRootPath);
|
||||
if (mParent) {
|
||||
fs->Init(mParent);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ OSFileSystem::Traverse(nsCycleCollectionTraversalCallback &cb)
|
||||
void
|
||||
OSFileSystem::SerializeDOMPath(nsAString& aOutput) const
|
||||
{
|
||||
aOutput = mLocalRootPath;
|
||||
aOutput = mLocalOrDeviceStorageRootPath;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace dom {
|
||||
|
||||
struct FileSystemFileResponse
|
||||
{
|
||||
PBlob blob;
|
||||
nsString realPath;
|
||||
};
|
||||
|
||||
struct FileSystemDirectoryResponse
|
||||
@@ -20,9 +20,10 @@ struct FileSystemDirectoryResponse
|
||||
nsString realPath;
|
||||
};
|
||||
|
||||
struct FileSystemDirectoryListingResponseBlob
|
||||
struct FileSystemDirectoryListingResponseFile
|
||||
{
|
||||
PBlob blob;
|
||||
// This is the full real path for the file that we are sending via IPC.
|
||||
nsString fileRealPath;
|
||||
};
|
||||
|
||||
struct FileSystemDirectoryListingResponseDirectory
|
||||
@@ -33,7 +34,7 @@ struct FileSystemDirectoryListingResponseDirectory
|
||||
|
||||
union FileSystemDirectoryListingResponseData
|
||||
{
|
||||
FileSystemDirectoryListingResponseBlob;
|
||||
FileSystemDirectoryListingResponseFile;
|
||||
FileSystemDirectoryListingResponseDirectory;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace dom {
|
||||
/* static */ already_AddRefed<RemoveTask>
|
||||
RemoveTask::Create(FileSystemBase* aFileSystem,
|
||||
nsIFile* aDirPath,
|
||||
BlobImpl* aTargetBlob,
|
||||
nsIFile* aTargetPath,
|
||||
bool aRecursive,
|
||||
ErrorResult& aRv)
|
||||
@@ -29,9 +28,10 @@ RemoveTask::Create(FileSystemBase* aFileSystem,
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
|
||||
MOZ_ASSERT(aFileSystem);
|
||||
MOZ_ASSERT(aDirPath);
|
||||
MOZ_ASSERT(aTargetPath);
|
||||
|
||||
RefPtr<RemoveTask> task =
|
||||
new RemoveTask(aFileSystem, aDirPath, aTargetBlob, aTargetPath, aRecursive);
|
||||
new RemoveTask(aFileSystem, aDirPath, aTargetPath, aRecursive);
|
||||
|
||||
// aTargetPath can be null. In this case SetError will be called.
|
||||
|
||||
@@ -72,33 +72,26 @@ RemoveTask::Create(FileSystemBase* aFileSystem,
|
||||
|
||||
task->mRecursive = aParam.recursive();
|
||||
|
||||
const FileSystemPathOrFileValue& target = aParam.target();
|
||||
|
||||
if (target.type() == FileSystemPathOrFileValue::TnsString) {
|
||||
NS_ConvertUTF16toUTF8 path(target);
|
||||
aRv = NS_NewNativeLocalFile(path, true, getter_AddRefs(task->mTargetPath));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return task.forget();
|
||||
NS_ConvertUTF16toUTF8 path(aParam.targetDirectory());
|
||||
aRv = NS_NewNativeLocalFile(path, true, getter_AddRefs(task->mTargetPath));
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BlobParent* bp = static_cast<BlobParent*>(static_cast<PBlobParent*>(target));
|
||||
task->mTargetBlobImpl = bp->GetBlobImpl();
|
||||
MOZ_ASSERT(task->mTargetBlobImpl);
|
||||
if (!FileSystemUtils::IsDescendantPath(task->mDirPath, task->mTargetPath)) {
|
||||
aRv.Throw(NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return task.forget();
|
||||
}
|
||||
|
||||
RemoveTask::RemoveTask(FileSystemBase* aFileSystem,
|
||||
nsIFile* aDirPath,
|
||||
BlobImpl* aTargetBlob,
|
||||
nsIFile* aTargetPath,
|
||||
bool aRecursive)
|
||||
: FileSystemTaskBase(aFileSystem)
|
||||
, mDirPath(aDirPath)
|
||||
, mTargetBlobImpl(aTargetBlob)
|
||||
, mTargetPath(aTargetPath)
|
||||
, mRecursive(aRecursive)
|
||||
, mReturnValue(false)
|
||||
@@ -106,6 +99,7 @@ RemoveTask::RemoveTask(FileSystemBase* aFileSystem,
|
||||
MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
|
||||
MOZ_ASSERT(aFileSystem);
|
||||
MOZ_ASSERT(aDirPath);
|
||||
MOZ_ASSERT(aTargetPath);
|
||||
}
|
||||
|
||||
RemoveTask::RemoveTask(FileSystemBase* aFileSystem,
|
||||
@@ -147,23 +141,15 @@ RemoveTask::GetRequestParams(const nsString& aSerializedDOMPath,
|
||||
}
|
||||
|
||||
param.recursive() = mRecursive;
|
||||
if (mTargetBlobImpl) {
|
||||
RefPtr<Blob> blob = Blob::Create(mFileSystem->GetParentObject(),
|
||||
mTargetBlobImpl);
|
||||
BlobChild* actor
|
||||
= ContentChild::GetSingleton()->GetOrCreateActorForBlob(blob);
|
||||
if (actor) {
|
||||
param.target() = actor;
|
||||
}
|
||||
} else {
|
||||
nsAutoString path;
|
||||
aRv = mTargetPath->GetPath(path);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return param;
|
||||
}
|
||||
|
||||
param.target() = path;
|
||||
nsAutoString path;
|
||||
aRv = mTargetPath->GetPath(path);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return param;
|
||||
}
|
||||
|
||||
param.targetDirectory() = path;
|
||||
|
||||
return param;
|
||||
}
|
||||
|
||||
@@ -194,16 +180,7 @@ RemoveTask::Work()
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Get the path if a File is passed as the target.
|
||||
if (mTargetBlobImpl) {
|
||||
if (!mFileSystem->GetRealPath(mTargetBlobImpl,
|
||||
getter_AddRefs(mTargetPath))) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
if (!FileSystemUtils::IsDescendantPath(mDirPath, mTargetPath)) {
|
||||
return NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(FileSystemUtils::IsDescendantPath(mDirPath, mTargetPath));
|
||||
|
||||
bool exists = false;
|
||||
nsresult rv = mTargetPath->Exists(&exists);
|
||||
|
||||
@@ -23,7 +23,6 @@ public:
|
||||
static already_AddRefed<RemoveTask>
|
||||
Create(FileSystemBase* aFileSystem,
|
||||
nsIFile* aDirPath,
|
||||
BlobImpl* aTargetBlob,
|
||||
nsIFile* aTargetPath,
|
||||
bool aRecursive,
|
||||
ErrorResult& aRv);
|
||||
@@ -64,7 +63,6 @@ protected:
|
||||
private:
|
||||
RemoveTask(FileSystemBase* aFileSystem,
|
||||
nsIFile* aDirPath,
|
||||
BlobImpl* aTargetBlob,
|
||||
nsIFile* aTargetPath,
|
||||
bool aRecursive);
|
||||
|
||||
@@ -73,12 +71,13 @@ private:
|
||||
FileSystemRequestParent* aParent);
|
||||
|
||||
RefPtr<Promise> mPromise;
|
||||
|
||||
// This path is the Directory::mFile.
|
||||
nsCOMPtr<nsIFile> mDirPath;
|
||||
|
||||
// This cannot be a File because this object will be used on a different
|
||||
// thread and File is not thread-safe. Let's use the BlobImpl instead.
|
||||
RefPtr<BlobImpl> mTargetBlobImpl;
|
||||
// This is what we want to remove. mTargetPath is discendant path of mDirPath.
|
||||
nsCOMPtr<nsIFile> mTargetPath;
|
||||
|
||||
bool mRecursive;
|
||||
bool mReturnValue;
|
||||
};
|
||||
|
||||
@@ -1,11 +1,23 @@
|
||||
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
Cu.importGlobalProperties(["File"]);
|
||||
|
||||
addMessageListener("dir.open", function () {
|
||||
addMessageListener("dir.open", function (e) {
|
||||
var testFile = Cc["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Ci.nsIDirectoryService)
|
||||
.QueryInterface(Ci.nsIProperties)
|
||||
.get("ProfD", Ci.nsIFile);
|
||||
.get(e.path == 'root' ? 'ProfD' : e.path, Ci.nsIFile);
|
||||
|
||||
// Let's go back to the root of the FileSystem
|
||||
if (e.path == 'root') {
|
||||
while (true) {
|
||||
var parent = testFile.parent;
|
||||
if (!parent) {
|
||||
break;
|
||||
}
|
||||
|
||||
testFile = parent;
|
||||
}
|
||||
}
|
||||
|
||||
sendAsyncMessage("dir.opened", {
|
||||
dir: testFile.path
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
var directory;
|
||||
|
||||
function create_fileList() {
|
||||
function create_fileList(aPath) {
|
||||
var url = SimpleTest.getTestFileURL("script_fileList.js");
|
||||
var script = SpecialPowers.loadChromeScript(url);
|
||||
|
||||
@@ -31,7 +31,7 @@ function create_fileList() {
|
||||
}
|
||||
|
||||
script.addMessageListener("dir.opened", onOpened);
|
||||
script.sendAsyncMessage("dir.open");
|
||||
script.sendAsyncMessage("dir.open", { path: aPath });
|
||||
}
|
||||
|
||||
function test_basic() {
|
||||
@@ -48,15 +48,17 @@ function checkSubDir(dir) {
|
||||
for (var i = 0; i < data.length; ++i) {
|
||||
ok (data[i] instanceof File || data[i] instanceof Directory, "Just Files or Directories");
|
||||
if (data[i] instanceof Directory) {
|
||||
isnot(data[i].name, '/', "Subdirectory should be called with the leafname");
|
||||
isnot(data[i].path, '/', "Subdirectory path should be called with the leafname");
|
||||
isnot(data[i].name, '/', "Subdirectory should be called with the leafname: " + data[i].name);
|
||||
isnot(data[i].path, '/', "Subdirectory path should be called with the leafname:" + data[i].path);
|
||||
isnot(data[i].path, dir.path, "Subdirectory path should contain the parent path.");
|
||||
is(data[i].path,dir.path + '/' + data[i].name, "Subdirectory path should be called parentdir.path + '/' + leafname");
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getFilesAndDirectories() {
|
||||
function getFilesAndDirectories(aRecursive) {
|
||||
directory.getFilesAndDirectories().then(
|
||||
function(data) {
|
||||
ok(data.length, "We should have some data.");
|
||||
@@ -65,8 +67,11 @@ function getFilesAndDirectories() {
|
||||
ok (data[i] instanceof File || data[i] instanceof Directory, "Just Files or Directories");
|
||||
if (data[i] instanceof Directory) {
|
||||
isnot(data[i].name, '/', "Subdirectory should be called with the leafname");
|
||||
isnot(data[i].path, '/', "Subdirectory path should be called with the leafname");
|
||||
promises.push(checkSubDir(data[i]));
|
||||
is(data[i].path, '/' + data[i].name, "Subdirectory path should be called '/' + leafname");
|
||||
|
||||
if (aRecursive) {
|
||||
promises.push(checkSubDir(data[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,11 +84,13 @@ function getFilesAndDirectories() {
|
||||
}
|
||||
|
||||
var tests = [
|
||||
create_fileList,
|
||||
|
||||
function() { create_fileList('ProfD') },
|
||||
test_basic,
|
||||
function() { getFilesAndDirectories(true) },
|
||||
|
||||
getFilesAndDirectories,
|
||||
function() { create_fileList('root') },
|
||||
test_basic,
|
||||
function() { getFilesAndDirectories(false) },
|
||||
];
|
||||
|
||||
function next() {
|
||||
|
||||
@@ -254,7 +254,7 @@ class HTMLInputElementState final : public nsISupports
|
||||
nsTArray<OwningFileOrDirectory>& aResult) const
|
||||
{
|
||||
for (uint32_t i = 0; i < mBlobImplsOrDirectoryPaths.Length(); ++i) {
|
||||
if (mBlobImplsOrDirectoryPaths[i].mType == Directory::BlobImplOrDirectoryPath::eBlobImpl) {
|
||||
if (mBlobImplsOrDirectoryPaths[i].mType == BlobImplOrDirectoryPath::eBlobImpl) {
|
||||
RefPtr<File> file =
|
||||
File::Create(aWindow,
|
||||
mBlobImplsOrDirectoryPaths[i].mBlobImpl);
|
||||
@@ -263,7 +263,7 @@ class HTMLInputElementState final : public nsISupports
|
||||
OwningFileOrDirectory* element = aResult.AppendElement();
|
||||
element->SetAsFile() = file;
|
||||
} else {
|
||||
MOZ_ASSERT(mBlobImplsOrDirectoryPaths[i].mType == Directory::BlobImplOrDirectoryPath::eDirectoryPath);
|
||||
MOZ_ASSERT(mBlobImplsOrDirectoryPaths[i].mType == BlobImplOrDirectoryPath::eDirectoryPath);
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
NS_ConvertUTF16toUTF8 path(mBlobImplsOrDirectoryPaths[i].mDirectoryPath);
|
||||
@@ -287,11 +287,10 @@ class HTMLInputElementState final : public nsISupports
|
||||
mBlobImplsOrDirectoryPaths.Clear();
|
||||
for (uint32_t i = 0; i < aArray.Length(); ++i) {
|
||||
if (aArray[i].IsFile()) {
|
||||
Directory::BlobImplOrDirectoryPath* data =
|
||||
mBlobImplsOrDirectoryPaths.AppendElement();
|
||||
BlobImplOrDirectoryPath* data = mBlobImplsOrDirectoryPaths.AppendElement();
|
||||
|
||||
data->mBlobImpl = aArray[i].GetAsFile()->Impl();
|
||||
data->mType = Directory::BlobImplOrDirectoryPath::eBlobImpl;
|
||||
data->mType = BlobImplOrDirectoryPath::eBlobImpl;
|
||||
} else {
|
||||
MOZ_ASSERT(aArray[i].IsDirectory());
|
||||
nsAutoString fullPath;
|
||||
@@ -300,11 +299,11 @@ class HTMLInputElementState final : public nsISupports
|
||||
continue;
|
||||
}
|
||||
|
||||
Directory::BlobImplOrDirectoryPath* data =
|
||||
BlobImplOrDirectoryPath* data =
|
||||
mBlobImplsOrDirectoryPaths.AppendElement();
|
||||
|
||||
data->mDirectoryPath = fullPath;
|
||||
data->mType = Directory::BlobImplOrDirectoryPath::eDirectoryPath;
|
||||
data->mType = BlobImplOrDirectoryPath::eDirectoryPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,7 +319,18 @@ class HTMLInputElementState final : public nsISupports
|
||||
|
||||
nsString mValue;
|
||||
|
||||
nsTArray<Directory::BlobImplOrDirectoryPath> mBlobImplsOrDirectoryPaths;
|
||||
struct BlobImplOrDirectoryPath
|
||||
{
|
||||
RefPtr<BlobImpl> mBlobImpl;
|
||||
nsString mDirectoryPath;
|
||||
|
||||
enum {
|
||||
eBlobImpl,
|
||||
eDirectoryPath
|
||||
} mType;
|
||||
};
|
||||
|
||||
nsTArray<BlobImplOrDirectoryPath> mBlobImplsOrDirectoryPaths;
|
||||
|
||||
bool mChecked;
|
||||
bool mCheckedSet;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
support-files =
|
||||
save_restore_radio_groups.sjs
|
||||
test_input_number_data.js
|
||||
!/dom/html/test/reflect.js
|
||||
|
||||
[test_bug1039548.html]
|
||||
[test_button_attributes_reflection.html]
|
||||
|
||||
@@ -7782,7 +7782,7 @@ class NormalJSRuntime
|
||||
{
|
||||
friend class nsAutoPtr<NormalJSRuntime>;
|
||||
|
||||
static const JSClass kGlobalClass;
|
||||
static const JSClass sGlobalClass;
|
||||
static const uint32_t kRuntimeHeapSize = 768 * 1024;
|
||||
|
||||
JSRuntime* mRuntime;
|
||||
@@ -23228,9 +23228,7 @@ CreateIndexOp::DoDatabaseWork(DatabaseConnection* aConnection)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
const JSClass NormalJSRuntime::kGlobalClass = {
|
||||
"IndexedDBTransactionThreadGlobal",
|
||||
JSCLASS_GLOBAL_FLAGS,
|
||||
static const JSClassOps sNormalJSRuntimeGlobalClassOps = {
|
||||
/* addProperty */ nullptr,
|
||||
/* delProperty */ nullptr,
|
||||
/* getProperty */ nullptr,
|
||||
@@ -23245,6 +23243,12 @@ const JSClass NormalJSRuntime::kGlobalClass = {
|
||||
/* trace */ JS_GlobalObjectTraceHook
|
||||
};
|
||||
|
||||
const JSClass NormalJSRuntime::sGlobalClass = {
|
||||
"IndexedDBTransactionThreadGlobal",
|
||||
JSCLASS_GLOBAL_FLAGS,
|
||||
&sNormalJSRuntimeGlobalClassOps
|
||||
};
|
||||
|
||||
bool
|
||||
NormalJSRuntime::Init()
|
||||
{
|
||||
@@ -23266,7 +23270,7 @@ NormalJSRuntime::Init()
|
||||
JSAutoRequest ar(mContext);
|
||||
|
||||
JS::CompartmentOptions options;
|
||||
mGlobal = JS_NewGlobalObject(mContext, &kGlobalClass, nullptr,
|
||||
mGlobal = JS_NewGlobalObject(mContext, &sGlobalClass, nullptr,
|
||||
JS::FireOnNewGlobalHook, options);
|
||||
if (NS_WARN_IF(!mGlobal)) {
|
||||
return false;
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
#include "mozilla/unused.h"
|
||||
|
||||
#include "mozInlineSpellChecker.h"
|
||||
#include "nsDocShell.h"
|
||||
#include "nsIConsoleListener.h"
|
||||
#include "nsICycleCollectorListener.h"
|
||||
#include "nsIDragService.h"
|
||||
@@ -868,12 +869,29 @@ ContentChild::ProvideWindowCommon(TabChild* aTabOpener,
|
||||
baseURI->GetSpec(baseURIString);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> opener = do_QueryInterface(aParent);
|
||||
nsIDocShell* openerShell;
|
||||
RefPtr<nsDocShell> openerDocShell;
|
||||
float fullZoom = 1.0f;
|
||||
if (opener && (openerShell = opener->GetDocShell())) {
|
||||
openerDocShell = static_cast<nsDocShell*>(openerShell);
|
||||
nsCOMPtr<nsIContentViewer> cv;
|
||||
openerDocShell->GetContentViewer(getter_AddRefs(cv));
|
||||
if (cv) {
|
||||
cv->GetFullZoom(&fullZoom);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
if (!SendCreateWindow(aTabOpener, newChild,
|
||||
aChromeFlags, aCalledFromJS, aPositionSpecified,
|
||||
aSizeSpecified, url,
|
||||
name, features,
|
||||
baseURIString,
|
||||
openerDocShell
|
||||
? openerDocShell->GetOriginAttributes()
|
||||
: OriginAttributes(),
|
||||
fullZoom,
|
||||
&rv,
|
||||
aWindowIsNew,
|
||||
&frameScripts,
|
||||
|
||||
@@ -5386,6 +5386,8 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
|
||||
const nsString& aName,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const OriginAttributes& aOpenerOriginAttributes,
|
||||
const float& aFullZoom,
|
||||
nsresult* aResult,
|
||||
bool* aWindowIsNew,
|
||||
InfallibleTArray<FrameScriptInfo>* aFrameScripts,
|
||||
@@ -5546,7 +5548,7 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
|
||||
|
||||
*aResult = pwwatch->OpenWindow2(parent, uri, name, features, aCalledFromJS,
|
||||
false, false, thisTabParent, nullptr, nullptr,
|
||||
getter_AddRefs(window));
|
||||
aFullZoom, 1, getter_AddRefs(window));
|
||||
|
||||
if (NS_WARN_IF(NS_FAILED(*aResult))) {
|
||||
return true;
|
||||
|
||||
@@ -497,6 +497,8 @@ public:
|
||||
const nsString& aName,
|
||||
const nsCString& aFeatures,
|
||||
const nsCString& aBaseURI,
|
||||
const OriginAttributes& aOpenerOriginAttributes,
|
||||
const float& aFullZoom,
|
||||
nsresult* aResult,
|
||||
bool* aWindowIsNew,
|
||||
InfallibleTArray<FrameScriptInfo>* aFrameScripts,
|
||||
|
||||
@@ -310,17 +310,11 @@ struct FileSystemGetFileOrDirectoryParams
|
||||
bool isRoot;
|
||||
};
|
||||
|
||||
union FileSystemPathOrFileValue
|
||||
{
|
||||
nsString;
|
||||
PBlob;
|
||||
};
|
||||
|
||||
struct FileSystemRemoveParams
|
||||
{
|
||||
nsString filesystem;
|
||||
nsString directory;
|
||||
FileSystemPathOrFileValue target;
|
||||
nsString targetDirectory;
|
||||
bool recursive;
|
||||
};
|
||||
|
||||
@@ -1179,7 +1173,9 @@ parent:
|
||||
nsCString aURI,
|
||||
nsString aName,
|
||||
nsCString aFeatures,
|
||||
nsCString aBaseURI)
|
||||
nsCString aBaseURI,
|
||||
OriginAttributes aOpenerOriginAttributes,
|
||||
float aFullZoom)
|
||||
returns (nsresult rv,
|
||||
bool windowOpened,
|
||||
FrameScriptInfo[] frameScripts,
|
||||
|
||||
@@ -66,7 +66,12 @@ this.ManifestObtainer = { // jshint ignore:line
|
||||
if (!aContent || isXULBrowser(aContent)) {
|
||||
throw new TypeError("Invalid input. Expected a DOM Window.");
|
||||
}
|
||||
const manifest = yield fetchManifest(aContent);
|
||||
let manifest;
|
||||
try {
|
||||
manifest = yield fetchManifest(aContent);
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
return manifest;
|
||||
}
|
||||
)};
|
||||
@@ -134,42 +139,22 @@ const fetchManifest = Task.async(function* (aWindow) {
|
||||
}
|
||||
// Throws on malformed URLs
|
||||
const manifestURL = new aWindow.URL(elem.href, elem.baseURI);
|
||||
if (!canLoadManifest(elem)) {
|
||||
let msg = `Content Security Policy: The page's settings blocked the `;
|
||||
msg += `loading of a resource at ${elem.href}`;
|
||||
throw new Error(msg);
|
||||
}
|
||||
const reqInit = {
|
||||
mode: "cors"
|
||||
};
|
||||
if (elem.crossOrigin === "use-credentials") {
|
||||
reqInit.credentials = "include";
|
||||
}
|
||||
const req = new aWindow.Request(manifestURL, reqInit);
|
||||
req.setContentPolicyType(Ci.nsIContentPolicy.TYPE_WEB_MANIFEST);
|
||||
const response = yield aWindow.fetch(req);
|
||||
const request = new aWindow.Request(manifestURL, reqInit);
|
||||
request.overrideContentPolicyType(Ci.nsIContentPolicy.TYPE_WEB_MANIFEST);
|
||||
let response;
|
||||
try {
|
||||
response = yield aWindow.fetch(request);
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
const manifest = yield processResponse(response, aWindow);
|
||||
return manifest;
|
||||
});
|
||||
|
||||
/**
|
||||
* Checks against security manager if we can load the web manifest.
|
||||
* @param {HTMLLinkElement} aElem The HTML element to security check.
|
||||
* @return {Boolean} True if it can, false if it can't.
|
||||
*/
|
||||
function canLoadManifest(aElem) {
|
||||
const contentPolicy = Cc["@mozilla.org/layout/content-policy;1"]
|
||||
.getService(Ci.nsIContentPolicy);
|
||||
const mimeType = aElem.type || "application/manifest+json";
|
||||
const elemURI = BrowserUtils.makeURI(
|
||||
aElem.href, aElem.ownerDocument.characterSet
|
||||
);
|
||||
const shouldLoad = contentPolicy.shouldLoad(
|
||||
Ci.nsIContentPolicy.TYPE_WEB_MANIFEST, elemURI,
|
||||
aElem.ownerDocument.documentURIObject,
|
||||
aElem, mimeType, null
|
||||
);
|
||||
return shouldLoad === Ci.nsIContentPolicy.ACCEPT;
|
||||
}
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ManifestObtainer"]; // jshint ignore:line
|
||||
|
||||
@@ -304,6 +304,8 @@ support-files =
|
||||
wavedata_u8.wav^headers^
|
||||
wavedata_ulaw.wav
|
||||
wavedata_ulaw.wav^headers^
|
||||
!/dom/canvas/test/captureStream_common.js
|
||||
!/dom/html/test/reflect.js
|
||||
|
||||
[test_access_control.html]
|
||||
skip-if = buildapp == 'b2g' && toolkit != 'gonk' # bug 1082984
|
||||
|
||||
@@ -6,6 +6,14 @@ skip-if = (os == 'win' && strictContentSandbox) || android_version == '10' || an
|
||||
support-files =
|
||||
/.well-known/idp-proxy/idp.js
|
||||
identityPcTest.js
|
||||
!/dom/media/tests/mochitest/blacksilence.js
|
||||
!/dom/media/tests/mochitest/dataChannel.js
|
||||
!/dom/media/tests/mochitest/head.js
|
||||
!/dom/media/tests/mochitest/network.js
|
||||
!/dom/media/tests/mochitest/pc.js
|
||||
!/dom/media/tests/mochitest/sdpUtils.js
|
||||
!/dom/media/tests/mochitest/templates.js
|
||||
!/dom/media/tests/mochitest/turnConfig.js
|
||||
tags = msg
|
||||
|
||||
[test_idpproxy.html]
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user