diff options
Diffstat (limited to 'js/io')
28 files changed, 357 insertions, 329 deletions
diff --git a/js/io/system/chromeapi.js b/js/io/system/chromeapi.js index 0650385f..44afd10c 100644 --- a/js/io/system/chromeapi.js +++ b/js/io/system/chromeapi.js | |||
@@ -1,24 +1,25 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility LLC. |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | ||
5 | 4 | ||
6 | Redistribution and use in source and binary forms, with or without | 5 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met: | 6 | modification, are permitted provided that the following conditions are met: |
8 | 7 | ||
9 | - Redistributions of source code must retain the above copyright notice, | 8 | * Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. | 9 | this list of conditions and the following disclaimer. |
11 | - Redistributions in binary form must reproduce the above copyright | 10 | |
12 | notice, this list of conditions and the following disclaimer in the | 11 | * Redistributions in binary form must reproduce the above copyright notice, |
13 | documentation and/or other materials provided with the distribution. | 12 | this list of conditions and the following disclaimer in the documentation |
14 | - Neither the name of Motorola Mobility nor the names of its contributors | 13 | and/or other materials provided with the distribution. |
15 | may be used to endorse or promote products derived from this software | 14 | |
16 | without specific prior written permission. | 15 | * Neither the name of Motorola Mobility LLC nor the names of its |
16 | contributors may be used to endorse or promote products derived from this | ||
17 | software without specific prior written permission. | ||
17 | 18 | ||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
@@ -34,7 +35,7 @@ NOTES: | |||
34 | 35 | ||
35 | The init function starts up the file system API, and a size must be | 36 | The init function starts up the file system API, and a size must be |
36 | set, no unlimited available as of now. | 37 | set, no unlimited available as of now. |
37 | 38 | ||
38 | //////////////////////////////////////////////////////////////////////// | 39 | //////////////////////////////////////////////////////////////////////// |
39 | ///////////////////////////////////////////////////////////////////// */ | 40 | ///////////////////////////////////////////////////////////////////// */ |
40 | // | 41 | // |
@@ -287,7 +288,7 @@ exports.ChromeApi = Montage.create(Object.prototype, { | |||
287 | } | 288 | } |
288 | } | 289 | } |
289 | //////////////////////////////////////////////////////////////////// | 290 | //////////////////////////////////////////////////////////////////// |
290 | //////////////////////////////////////////////////////////////////// | 291 | //////////////////////////////////////////////////////////////////// |
291 | }); | 292 | }); |
292 | //////////////////////////////////////////////////////////////////////// | 293 | //////////////////////////////////////////////////////////////////////// |
293 | //////////////////////////////////////////////////////////////////////// | 294 | //////////////////////////////////////////////////////////////////////// |
diff --git a/js/io/system/coreioapi.js b/js/io/system/coreioapi.js index d3977106..b8c08832 100755 --- a/js/io/system/coreioapi.js +++ b/js/io/system/coreioapi.js | |||
@@ -1,24 +1,25 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility LLC. |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | ||
5 | 4 | ||
6 | Redistribution and use in source and binary forms, with or without | 5 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met: | 6 | modification, are permitted provided that the following conditions are met: |
8 | 7 | ||
9 | - Redistributions of source code must retain the above copyright notice, | 8 | * Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. | 9 | this list of conditions and the following disclaimer. |
11 | - Redistributions in binary form must reproduce the above copyright | 10 | |
12 | notice, this list of conditions and the following disclaimer in the | 11 | * Redistributions in binary form must reproduce the above copyright notice, |
13 | documentation and/or other materials provided with the distribution. | 12 | this list of conditions and the following disclaimer in the documentation |
14 | - Neither the name of Motorola Mobility nor the names of its contributors | 13 | and/or other materials provided with the distribution. |
15 | may be used to endorse or promote products derived from this software | 14 | |
16 | without specific prior written permission. | 15 | * Neither the name of Motorola Mobility LLC nor the names of its |
16 | contributors may be used to endorse or promote products derived from this | ||
17 | software without specific prior written permission. | ||
17 | 18 | ||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
@@ -33,7 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. | |||
33 | NOTES: | 34 | NOTES: |
34 | 35 | ||
35 | Core API reference in NINJA: this.application.ninja.coreIoApi | 36 | Core API reference in NINJA: this.application.ninja.coreIoApi |
36 | 37 | ||
37 | //////////////////////////////////////////////////////////////////////// | 38 | //////////////////////////////////////////////////////////////////////// |
38 | ///////////////////////////////////////////////////////////////////// */ | 39 | ///////////////////////////////////////////////////////////////////// */ |
39 | var Montage = require("montage/core/core").Montage, | 40 | var Montage = require("montage/core/core").Montage, |
@@ -101,7 +102,7 @@ exports.CoreIoApi = Montage.create(Component, { | |||
101 | this.ninjaLibrary.addEventListener('sync', this, false); | 102 | this.ninjaLibrary.addEventListener('sync', this, false); |
102 | //Sending library to be synced to chrome | 103 | //Sending library to be synced to chrome |
103 | this.ninjaLibrary.synchronize(e._event.ninjaChromeLibrary, this.chromeFileSystem); | 104 | this.ninjaLibrary.synchronize(e._event.ninjaChromeLibrary, this.chromeFileSystem); |
104 | 105 | ||
105 | } | 106 | } |
106 | }, | 107 | }, |
107 | //////////////////////////////////////////////////////////////////// | 108 | //////////////////////////////////////////////////////////////////// |
@@ -389,7 +390,7 @@ exports.CoreIoApi = Montage.create(Component, { | |||
389 | try { | 390 | try { |
390 | var serviceURL = this._prepareServiceURL(this.fileServiceURL, file.uri), | 391 | var serviceURL = this._prepareServiceURL(this.fileServiceURL, file.uri), |
391 | xhr = new XMLHttpRequest(); | 392 | xhr = new XMLHttpRequest(); |
392 | // | 393 | // |
393 | xhr.open("GET", serviceURL, false); | 394 | xhr.open("GET", serviceURL, false); |
394 | xhr.setRequestHeader("check-existence-only", "true"); | 395 | xhr.setRequestHeader("check-existence-only", "true"); |
395 | xhr.send(); | 396 | xhr.send(); |
@@ -434,12 +435,12 @@ exports.CoreIoApi = Montage.create(Component, { | |||
434 | xhr = new XMLHttpRequest(); | 435 | xhr = new XMLHttpRequest(); |
435 | // | 436 | // |
436 | xhr.open("POST", serviceURL, false); | 437 | xhr.open("POST", serviceURL, false); |
437 | //xhr.responseType = "arraybuffer"; | 438 | //xhr.responseType = "arraybuffer"; |
438 | if(file.contentType && file.contentType.length) | 439 | if(file.contentType && file.contentType.length) |
439 | xhr.setRequestHeader("Content-Type", file.contentType); | 440 | xhr.setRequestHeader("Content-Type", file.contentType); |
440 | else | 441 | else |
441 | xhr.setRequestHeader("Content-Type", "text/plain"); | 442 | xhr.setRequestHeader("Content-Type", "text/plain"); |
442 | 443 | ||
443 | if (file.contents) | 444 | if (file.contents) |
444 | xhr.send(file.contents); | 445 | xhr.send(file.contents); |
445 | else | 446 | else |
@@ -700,7 +701,7 @@ exports.CoreIoApi = Montage.create(Component, { | |||
700 | // status: int indicating the request HTTP status code | 701 | // status: int indicating the request HTTP status code |
701 | // 200 - the file was read and its contents were returned | 702 | // 200 - the file was read and its contents were returned |
702 | // 404 - the file does not exist | 703 | // 404 - the file does not exist |
703 | // 500 - unknown server error occurred | 704 | // 500 - unknown server error occurred |
704 | readExternalFile: { | 705 | readExternalFile: { |
705 | enumerable: false, | 706 | enumerable: false, |
706 | value: function(file) { | 707 | value: function(file) { |
@@ -893,7 +894,7 @@ exports.CoreIoApi = Montage.create(Component, { | |||
893 | var retValue = { success:null, content:null, status:null }; | 894 | var retValue = { success:null, content:null, status:null }; |
894 | if(dir && dir.uri && dir.uri.length) { | 895 | if(dir && dir.uri && dir.uri.length) { |
895 | try { | 896 | try { |
896 | var serviceURL = this._prepareServiceURL(this.directoryServiceURL, dir.uri), | 897 | var serviceURL = this._prepareServiceURL(this.directoryServiceURL, dir.uri), |
897 | xhr = new XMLHttpRequest(); | 898 | xhr = new XMLHttpRequest(); |
898 | // | 899 | // |
899 | xhr.open("GET", serviceURL, false); | 900 | xhr.open("GET", serviceURL, false); |
diff --git a/js/io/system/fileio.js b/js/io/system/fileio.js index d4de74f9..0c9bf9fb 100755 --- a/js/io/system/fileio.js +++ b/js/io/system/fileio.js | |||
@@ -1,24 +1,25 @@ | |||
1 | /* <copyright> |