File tree Expand file tree Collapse file tree 6 files changed +46
-18
lines changed
Expand file tree Collapse file tree 6 files changed +46
-18
lines changed Original file line number Diff line number Diff line change @@ -398,6 +398,10 @@ to config.xml in order for the application to find previously stored files.
398398 </platform >
399399
400400 <platform name =" browser" >
401+ <js-module src =" www/browser/isChrome.js" name =" isChrome" >
402+ <runs />
403+ </js-module >
404+
401405 <!-- File for Chrome -->
402406 <js-module src =" www/browser/Preparing.js" name =" Preparing" >
403407 <runs />
Original file line number Diff line number Diff line change 2525
2626/* Heavily based on https://github.com/ebidel/idb.filesystem.js */
2727
28- // window.webkitRequestFileSystem and window.webkitResolveLocalFileSystemURL
29- // are available only in Chrome and possible a good flag to indicate
30- // that we're running in Chrome
31- var isChrome = window . webkitRequestFileSystem && window . webkitResolveLocalFileSystemURL ;
32-
3328// For chrome we don't need to implement proxy methods
3429// All functionality can be accessed natively.
35- if ( isChrome ) {
30+ if ( require ( './ isChrome' ) ( ) ) {
3631 var pathsPrefix = {
3732 // Read-only directory where the application is installed.
3833 applicationDirectory : location . origin + "/" ,
Original file line number Diff line number Diff line change 2222/*global require*/
2323
2424//Only Chrome uses this file.
25- var isChrome = window . webkitRequestFileSystem && window . webkitResolveLocalFileSystemURL ;
26- if ( ! isChrome ) {
25+ if ( ! require ( './isChrome' ) ( ) ) {
2726 return ;
2827}
2928
Original file line number Diff line number Diff line change 1+ /*
2+ *
3+ * Licensed to the Apache Software Foundation (ASF) under one
4+ * or more contributor license agreements. See the NOTICE file
5+ * distributed with this work for additional information
6+ * regarding copyright ownership. The ASF licenses this file
7+ * to you under the Apache License, Version 2.0 (the
8+ * "License"); you may not use this file except in compliance
9+ * with the License. You may obtain a copy of the License at
10+ *
11+ * http://www.apache.org/licenses/LICENSE-2.0
12+ *
13+ * Unless required by applicable law or agreed to in writing,
14+ * software distributed under the License is distributed on an
15+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+ * KIND, either express or implied. See the License for the
17+ * specific language governing permissions and limitations
18+ * under the License.
19+ *
20+ */
21+
22+ module . exports = function ( ) {
23+ // window.webkitRequestFileSystem and window.webkitResolveLocalFileSystemURL are available only in Chrome and
24+ // possibly a good flag to indicate that we're running in Chrome
25+ return window . webkitRequestFileSystem && window . webkitResolveLocalFileSystemURL ;
26+ } ;
Original file line number Diff line number Diff line change 2121
2222//For browser platform: not all browsers use this file.
2323function checkBrowser ( ) {
24- if ( cordova . platformId === "browser" && navigator . userAgent . search ( / C h r o m e / ) > 0 ) {
25- var requestFileSystem = window . requestFileSystem || window . webkitRequestFileSystem ;
26- module . exports = requestFileSystem ;
27- return ;
24+ if ( cordova . platformId === "browser" && require ( './isChrome' ) ( ) ) {
25+ module . exports = window . requestFileSystem || window . webkitRequestFileSystem ;
26+ return true ;
2827 }
28+ return false ;
29+ }
30+ if ( checkBrowser ( ) ) {
31+ return ;
2932}
30- checkBrowser ( ) ;
3133
3234var argscheck = require ( 'cordova/argscheck' ) ,
3335 FileError = require ( './FileError' ) ,
Original file line number Diff line number Diff line change 2121
2222//For browser platform: not all browsers use overrided `resolveLocalFileSystemURL`.
2323function checkBrowser ( ) {
24- if ( cordova . platformId === "browser" && navigator . userAgent . search ( / C h r o m e / ) > 0 ) {
25- var resolveLocalFileSystemURL = window . resolveLocalFileSystemURL || window . webkitResolveLocalFileSystemURL ;
26- module . exports . resolveLocalFileSystemURL = resolveLocalFileSystemURL ;
27- return ;
24+ if ( cordova . platformId === "browser" && require ( './isChrome' ) ( ) ) {
25+ module . exports . resolveLocalFileSystemURL = window . resolveLocalFileSystemURL || window . webkitResolveLocalFileSystemURL ;
26+ return true ;
2827 }
28+ return false ;
29+ }
30+ if ( checkBrowser ( ) ) {
31+ return ;
2932}
30- checkBrowser ( ) ;
3133
3234var argscheck = require ( 'cordova/argscheck' ) ,
3335 DirectoryEntry = require ( './DirectoryEntry' ) ,
You can’t perform that action at this time.
0 commit comments