FileHandle is not supported in b2g yet :( Jan Dňa 9.4.2013 4:07, "DongSheng Xue" <[email protected]> napísal(-a):
> Hi all, > I'm sorrry to bother you. I have two questions about DeviceStorageAPI > and FileHandleAPI. I need some help :) > > 1, DOMRequest getEditable(DOMString name);(https://wiki.mozilla.** > org/WebAPI/DeviceStorageAPI<https://wiki.mozilla.org/WebAPI/DeviceStorageAPI> > ) > The comment is '// Returns the result as a FileHandle object which > enables writin' . But I printed the result, it is a File object not a > FileHandle object, why? > Here is my simple code: > var myDB = window.navigator.**getDeviceStorage('music'); > var req = myDB.addNamed(dummyblob, fileName); > req.onsuccess = function() { > var req2 = myDB.getEditable(fileName); > req2.onsuccess = function() { > var file = req2.result; > console.log('getFileEditable: ' + file); > } > } > the out is: getFileEditable: [object File] > > > 2, IDBRequest mozCreateFileHandle(DOMString name, optional DOMString > type);(https://wiki.mozilla.**org/WebAPI/FileHandleAPI<https://wiki.mozilla.org/WebAPI/FileHandleAPI> > ) > Here is my simple code: > const name = window.location.pathname; > var request = indexedDB.open(name, 1); > request.onsuccess = function(event) { > var fileDB = event.target.result; > request2 = fileDB.mozCreateFileHandle("**temp.bin", > "binary/random"); > } > the out is: > F/libc ( 6356): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1) > I/IdleService( 6312): Get idle time: time since reset 884 msec > I/IdleService( 6312): Idle timer callback: current idle time 884 msec > I/IdleService( 6312): next timeout 115 msec from now > I/IdleService( 6312): SetTimerExpiryIfBefore: next timeout 115 msec from > now > I/IdleService( 6312): reset timer expiry to 125 msec from now > I/IdleService( 6312): Get idle time: time since reset 1007 msec > I/IdleService( 6312): Idle timer callback: current idle time 1007 msec > I/IdleService( 6312): next timeout 4294967293991 msec from now > I/IdleService( 6312): SetTimerExpiryIfBefore: next timeout 4294967293990 > msec from now > I/IdleService( 6312): reset timer expiry to 4294967293999 msec from now > I/IdleService( 6312): Idle timer callback: tell observer 482b5030 user is > idle > I/IdleService( 6312): Get idle time: time since reset 1012 msec > I/DEBUG ( 108): *** *** *** *** *** *** *** *** *** *** *** *** *** *** > *** *** > I/DEBUG ( 108): Build fingerprint: 'toro/full_otoro/otoro:4.0.4.** > 0.4.0.4/OPENMASTER/eng.dxue.**20130301.135235:eng/test-keys' > I/DEBUG ( 108): pid: 6356, tid: 6356 >>> /system/b2g/plugin-container > <<< > I/DEBUG ( 108): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr > 00000000 > I/DEBUG ( 108): r0 00000000 r1 00000000 r2 42b3c2c0 r3 40416f5d > I/DEBUG ( 108): r4 445ffb40 r5 00000000 r6 becef524 r7 becef534 > I/DEBUG ( 108): r8 445ffb40 r9 43bd3dc0 10 413507d0 fp 44141bc0 > I/DEBUG ( 108): ip 414b6970 sp becef438 lr 407d57b5 pc 407d57b8 > cpsr 60000030 > I/DEBUG ( 108): d0 0072002f00790072 d1 006f0064006e0061 > I/DEBUG ( 108): d2 0072006f002e0073 d3 0073006a002f0000 > I/DEBUG ( 108): d4 ffffff8100010000 d5 ffffff8100020000 > I/DEBUG ( 108): d6 ffffff8100040000 d7 0000000f00080000 > I/DEBUG ( 108): d8 0000000000000000 d9 0000000000000000 > I/DEBUG ( 108): d10 0000000000000000 d11 0000000000000000 > I/DEBUG ( 108): d12 0000000000000000 d13 0000000000000000 > I/DEBUG ( 108): d14 0000000000000000 d15 0000000000000000 > I/DEBUG ( 108): d16 ffffff85434a97c0 d17 c3e0000000000000 > I/DEBUG ( 108): d18 ffffff8100400000 d19 ffffff8100800000 > I/DEBUG ( 108): d20 ffffff8101000000 d21 ffffff8102000000 > I/DEBUG ( 108): d22 ffffff8104000000 d23 ffffff8108000000 > I/DEBUG ( 108): d24 3ff0000000000000 d25 0000000000000000 > I/DEBUG ( 108): d26 0000000000000000 d27 0000000000000000 > I/DEBUG ( 108): d28 0000000000800000 d29 0000000000400000 > I/DEBUG ( 108): d30 0000000000200000 d31 0000000000100000 > I/DEBUG ( 108): scr 20000011 > I/DEBUG ( 108): > I/DEBUG ( 108): #00 pc 003c47b8 /system/b2g/libxul.so > I/DEBUG ( 108): #01 lr 407d57b5 /system/b2g/libxul.so > I/DEBUG ( 108): > I/DEBUG ( 108): code around pc: > I/DEBUG ( 108): 407d5798 fdbaf01b 70e0ea00 bf00bd3e 8000ffff > .......p>....... > I/DEBUG ( 108): 407d57a8 6803b570 460d4604 47986b5b db0f2800 > p..h.F.F[k.G.(.. > I/DEBUG ( 108): 407d57b8 2200682b 46214628 479868db db072800 > +h."(F!F.h.G.(.. > I/DEBUG ( 108): 407d57c8 b1086960 fdaef011 23012000 3020f884 `i....... > .#.. 0 > I/DEBUG ( 108): 407d57d8 bf00bd70 4604b5f7 f6e4f00f 28006965 > p......F....ei.( > I/DEBUG ( 108): > I/DEBUG ( 108): code around lr: > I/DEBUG ( 108): 407d5794 93004622 fdbaf01b 70e0ea00 bf00bd3e > "F.........p>... > I/DEBUG ( 108): 407d57a4 8000ffff 6803b570 460d4604 47986b5b > ....p..h.F.F[k.G > I/DEBUG ( 108): 407d57b4 db0f2800 2200682b 46214628 479868db > .(..+h."(F!F.h.G > I/DEBUG ( 108): 407d57c4 db072800 b1086960 fdaef011 23012000 > .(..`i....... .# > I/DEBUG ( 108): 407d57d4 3020f884 bf00bd70 4604b5f7 f6e4f00f .. > 0p......F.... > I/DEBUG ( 108): > I/DEBUG ( 108): stack: > I/DEBUG ( 108): becef3f8 445ffb70 > I/DEBUG ( 108): becef3fc 43d9a480 > I/DEBUG ( 108): becef400 0000000d > I/DEBUG ( 108): becef404 becef41c [stack] > I/DEBUG ( 108): becef408 445ffb70 > I/DEBUG ( 108): becef40c becef524 [stack] > I/DEBUG ( 108): becef410 0000000d > I/DEBUG ( 108): becef414 40c1608d /system/b2g/libxul.so > I/DEBUG ( 108): becef418 445ffb70 > I/DEBUG ( 108): becef41c becef524 [stack] > I/DEBUG ( 108): becef420 00000000 > I/DEBUG ( 108): becef424 00000001 > I/DEBUG ( 108): becef428 becef524 [stack] > I/DEBUG ( 108): becef42c becef534 [stack] > I/DEBUG ( 108): becef430 df0027ad > I/DEBUG ( 108): becef434 00000000 > I/DEBUG ( 108): #00 becef438 00000000 > I/DEBUG ( 108): becef43c 00000001 > I/DEBUG ( 108): becef440 becef524 [stack] > I/DEBUG ( 108): becef444 407d9cab /system/b2g/libxul.so > I/DEBUG ( 108): becef448 42d00078 > I/DEBUG ( 108): becef44c 00000000 > I/DEBUG ( 108): becef450 42c49020 > I/DEBUG ( 108): becef454 4365a3e0 > I/DEBUG ( 108): becef458 becef524 [stack] > I/DEBUG ( 108): becef45c becef544 [stack] > I/DEBUG ( 108): becef460 407d9bf1 /system/b2g/libxul.so > I/DEBUG ( 108): becef464 4097f763 /system/b2g/libxul.so > I/DEBUG ( 108): becef468 becef544 [stack] > I/DEBUG ( 108): becef46c 00000002 > I/DEBUG ( 108): becef470 00000000 > I/DEBUG ( 108): becef474 becef50f [stack] > I/DEBUG ( 108): becef478 4365a3e0 > I/DEBUG ( 108): becef47c ffffff87 > I/Gecko ( 6312): > I/Gecko ( 6312): ###!!! [Parent][AsyncChannel] Error: Channel error: > cannot send/recv > I/Gecko ( 6312): > I/Gecko ( 6312): > I/Gecko ( 6312): ###!!! [Parent][AsyncChannel] Error: Channel error: > cannot send/recv > I/Gecko ( 6312): > D/memalloc( 6312): /dev/pmem: Allocated buffer base:0x4a500000 size:307200 > offset:614400 fd:73 > I/Gecko ( 6312): TCPServerSocket: onStopListening was called. > > Thanks > Chardis > > > ______________________________**_________________ > dev-b2g mailing list > [email protected] > https://lists.mozilla.org/**listinfo/dev-b2g<https://lists.mozilla.org/listinfo/dev-b2g> > _______________________________________________ dev-b2g mailing list [email protected] https://lists.mozilla.org/listinfo/dev-b2g
