Open
Bug 852864
Opened 12 years ago
Updated 2 years ago
DeviceStorage addNamed failed with TypeMismatchError
Categories
(Core :: DOM: Core & HTML, defect, P5)
Tracking
()
NEW
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.
Comment 1•12 years ago
|
||
Confirmed. The type checking code in nsDeviceStorage.cpp checks that the mimetype starts with "audio/" for music files.
Comment 2•12 years ago
|
||
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
Comment 3•11 years ago
|
||
ping any movement on this ?
Comment 4•11 years ago
|
||
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)
Comment 5•11 years ago
|
||
we probably should relax the requirement of having the right mime type.
Flags: needinfo?(doug.turner)
Reporter | ||
Comment 6•11 years ago
|
||
or can we get a list of all mime types of musics? then check whether file's mimetype is in the list
Comment 7•11 years ago
|
||
Reporter | ||
Comment 8•11 years ago
|
||
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
Comment 9•7 years ago
|
||
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
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•