MCPcopy Create free account
hub / github.com/breck7/scroll / fs_error

Function fs_error

external/.datatables.js:15697–15729  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15695 },
15696 // on any filesys errors revert to saving with object URLs
15697 fs_error = function () {
15698 if ((is_chrome_ios || (force && is_safari)) && view.FileReader) {
15699 // Safari doesn't allow downloading of blob urls
15700 var reader = new FileReader()
15701 reader.onloadend = function () {
15702 var url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, "data:attachment/file;")
15703 var popup = view.open(url, "_blank")
15704 if (!popup) view.location.href = url
15705 url = undefined // release reference before dispatching
15706 filesaver.readyState = filesaver.DONE
15707 dispatch_all()
15708 }
15709 reader.readAsDataURL(blob)
15710 filesaver.readyState = filesaver.INIT
15711 return
15712 }
15713 // don't create more object URLs than needed
15714 if (!object_url) {
15715 object_url = get_URL().createObjectURL(blob)
15716 }
15717 if (force) {
15718 view.location.href = object_url
15719 } else {
15720 var opened = view.open(object_url, "_blank")
15721 if (!opened) {
15722 // Apple does not allow window.open, see https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html
15723 view.location.href = object_url
15724 }
15725 }
15726 filesaver.readyState = filesaver.DONE
15727 dispatch_all()
15728 revoke(object_url)
15729 }
15730 filesaver.readyState = filesaver.INIT
15731
15732 if (can_use_save_link) {

Callers 1

FileSaverFunction · 0.85

Calls 4

dispatch_allFunction · 0.85
get_URLFunction · 0.85
revokeFunction · 0.85
replaceMethod · 0.80

Tested by

no test coverage detected