Open Bug 852864 Opened 12 years ago Updated 2 years ago

DeviceStorage addNamed failed with TypeMismatchError

Categories

(Core :: DOM: Core & HTML, defect, P5)

x86_64
Gonk (Firefox OS)
defect

Tracking

()

People

(Reporter: wdeng, Unassigned)

Details

test script is like below: var storage = navigator.getDeviceStorage('music'); var getRequest = storage.get('Music/sample.ogg'); getRequest.onsuccess = function() { var f = getRequest.result; console.log('sample.ogg's type is:' + f.type); var req = storage.addNamed(f, 'Music/test-new.ogg'); req.onsuccess = function() { console.log('addNamed success'); }; req.onerror = function() { console.log('addNamed failed' + req.error.name); }; }; the console log: "sample.ogg's type is video/ogg" "addNamed failed TypeMismatchError". Actually the sample.ogg is an audio file, but the file object "f" returned from storage.get(), its type is "video/ogg" not "audio/ogg", so ,I think this is the reason of the problme.
Confirmed. The type checking code in nsDeviceStorage.cpp checks that the mimetype starts with "audio/" for music files.
I have the same problem when trying to save a file. Mp3 audio from the browser "example: http://download.wavetlan.com/SVV/Media/HTTP/MP3/Helix_Mobile_Producer/HelixMobileProducer_test2_MPEG1_Stereo_CBR_96kbps_32000Hz.mp3 The file is detected as a video file
ping any movement on this ?
toolkit/content/devicestorage.properties has *.ogg in music and not videos. But that change was made before this bug's initial filing so I don't know what's up. Doug?
Flags: needinfo?(doug.turner)
we probably should relax the requirement of having the right mime type.
Flags: needinfo?(doug.turner)
or can we get a list of all mime types of musics? then check whether file's mimetype is in the list
File extensions are different with file mimetypes. Now in devicestorage, both are checked. http://mxr.mozilla.org/mozilla-central/source/dom/devicestorage/nsDeviceStorage.cpp#2854 typeChecker->Check(mStorageType, dsf->mFile) //check file extensions typeChecker->Check(mStorageType, aBlob) //check file mimetypes If relax mimetype checking ,just remove the later one
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.