Skip to content

Commit 1dbfefc

Browse files
author
carsonxu
committedJan 18, 2021
修复 global 报错
1 parent 9dfa8be commit 1dbfefc

File tree

5 files changed

+50
-53
lines changed

5 files changed

+50
-53
lines changed
 

‎dist/cos-js-sdk-v5.js

+46-48
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,17 @@ return /******/ (function(modules) { // webpackBootstrap
7070
/******/ __webpack_require__.p = "/dist/";
7171
/******/
7272
/******/ // Load entry module and return exports
73-
/******/ return __webpack_require__(__webpack_require__.s = 5);
73+
/******/ return __webpack_require__(__webpack_require__.s = 4);
7474
/******/ })
7575
/************************************************************************/
7676
/******/ ([
7777
/* 0 */
7878
/***/ (function(module, exports, __webpack_require__) {
7979

8080
"use strict";
81-
/* WEBPACK VAR INJECTION */(function(global) {
8281

83-
var md5 = __webpack_require__(7);
82+
83+
var md5 = __webpack_require__(6);
8484
var CryptoJS = __webpack_require__(10);
8585
var xml2json = __webpack_require__(11);
8686
var json2xml = __webpack_require__(14);
@@ -552,8 +552,7 @@ var apiWrapper = function (apiName, apiFn) {
552552

553553
var errMsg = checkParams();
554554
var isSync = apiName === 'getAuth' || apiName === 'getObjectUrl';
555-
var Promise = global.Promise;
556-
if (!isSync && Promise && !callback) {
555+
if (Promise && !isSync && !callback) {
557556
return new Promise(function (resolve, reject) {
558557
callback = function (err, data) {
559558
err ? reject(err) : resolve(data);
@@ -664,39 +663,11 @@ var util = {
664663
};
665664

666665
module.exports = util;
667-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
668666

669667
/***/ }),
670668
/* 1 */
671669
/***/ (function(module, exports) {
672670

673-
var g;
674-
675-
// This works in non-strict mode
676-
g = (function() {
677-
return this;
678-
})();
679-
680-
try {
681-
// This works if eval is allowed (see CSP)
682-
g = g || Function("return this")() || (1,eval)("this");
683-
} catch(e) {
684-
// This works if the window reference is available
685-
if(typeof window === "object")
686-
g = window;
687-
}
688-
689-
// g can still be undefined, but nothing to do about it...
690-
// We return undefined, instead of nothing here, so it's
691-
// easier to handle this case. if(!global) { ...}
692-
693-
module.exports = g;
694-
695-
696-
/***/ }),
697-
/* 2 */
698-
/***/ (function(module, exports) {
699-
700671
/*
701672
* DOM Level 2
702673
* Object DOMException
@@ -1944,7 +1915,7 @@ try{
19441915

19451916

19461917
/***/ }),
1947-
/* 3 */
1918+
/* 2 */
19481919
/***/ (function(module, exports) {
19491920

19501921
var initEvent = function (cos) {
@@ -1983,7 +1954,7 @@ module.exports.init = initEvent;
19831954
module.exports.EventProxy = EventProxy;
19841955

19851956
/***/ }),
1986-
/* 4 */
1957+
/* 3 */
19871958
/***/ (function(module, exports, __webpack_require__) {
19881959

19891960
var util = __webpack_require__(0);
@@ -2089,21 +2060,21 @@ var mod = {
20892060
module.exports = mod;
20902061

20912062
/***/ }),
2092-
/* 5 */
2063+
/* 4 */
20932064
/***/ (function(module, exports, __webpack_require__) {
20942065

2095-
var COS = __webpack_require__(6);
2066+
var COS = __webpack_require__(5);
20962067
module.exports = COS;
20972068

20982069
/***/ }),
2099-
/* 6 */
2070+
/* 5 */
21002071
/***/ (function(module, exports, __webpack_require__) {
21012072

21022073
"use strict";
21032074

21042075

21052076
var util = __webpack_require__(0);
2106-
var event = __webpack_require__(3);
2077+
var event = __webpack_require__(2);
21072078
var task = __webpack_require__(15);
21082079
var base = __webpack_require__(16);
21092080
var advance = __webpack_require__(18);
@@ -2161,12 +2132,12 @@ base.init(COS, task);
21612132
advance.init(COS, task);
21622133

21632134
COS.getAuthorization = util.getAuth;
2164-
COS.version = '1.1.8';
2135+
COS.version = '1.1.9';
21652136

21662137
module.exports = COS;
21672138

21682139
/***/ }),
2169-
/* 7 */
2140+
/* 6 */
21702141
/***/ (function(module, exports, __webpack_require__) {
21712142

21722143
/* WEBPACK VAR INJECTION */(function(process, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/* https://github.com/emn178/js-md5 */
@@ -2836,10 +2807,10 @@ module.exports = COS;
28362807
}
28372808
}
28382809
})();
2839-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8), __webpack_require__(1)))
2810+
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(8)))
28402811

28412812
/***/ }),
2842-
/* 8 */
2813+
/* 7 */
28432814
/***/ (function(module, exports) {
28442815

28452816
// shim for using process in browser
@@ -3028,6 +2999,33 @@ process.chdir = function (dir) {
30282999
process.umask = function() { return 0; };
30293000

30303001

3002+
/***/ }),
3003+
/* 8 */
3004+
/***/ (function(module, exports) {
3005+
3006+
var g;
3007+
3008+
// This works in non-strict mode
3009+
g = (function() {
3010+
return this;
3011+
})();
3012+
3013+
try {
3014+
// This works if eval is allowed (see CSP)
3015+
g = g || Function("return this")() || (1,eval)("this");
3016+
} catch(e) {
3017+
// This works if the window reference is available
3018+
if(typeof window === "object")
3019+
g = window;
3020+
}
3021+
3022+
// g can still be undefined, but nothing to do about it...
3023+
// We return undefined, instead of nothing here, so it's
3024+
// easier to handle this case. if(!global) { ...}
3025+
3026+
module.exports = g;
3027+
3028+
30313029
/***/ }),
30323030
/* 9 */
30333031
/***/ (function(module, exports) {
@@ -3702,8 +3700,8 @@ function appendElement (hander,node) {
37023700

37033701
//if(typeof require == 'function'){
37043702
var XMLReader = __webpack_require__(13).XMLReader;
3705-
var DOMImplementation = exports.DOMImplementation = __webpack_require__(2).DOMImplementation;
3706-
exports.XMLSerializer = __webpack_require__(2).XMLSerializer ;
3703+
var DOMImplementation = exports.DOMImplementation = __webpack_require__(1).DOMImplementation;
3704+
exports.XMLSerializer = __webpack_require__(1).XMLSerializer ;
37073705
exports.DOMParser = DOMParser;
37083706
//}
37093707

@@ -4510,7 +4508,7 @@ module.exports = function (obj, options) {
45104508
/* 15 */
45114509
/***/ (function(module, exports, __webpack_require__) {
45124510

4513-
var session = __webpack_require__(4);
4511+
var session = __webpack_require__(3);
45144512
var util = __webpack_require__(0);
45154513

45164514
var originApiMap = {};
@@ -8350,9 +8348,9 @@ module.exports = request;
83508348
/* 18 */
83518349
/***/ (function(module, exports, __webpack_require__) {
83528350

8353-
var session = __webpack_require__(4);
8351+
var session = __webpack_require__(3);
83548352
var Async = __webpack_require__(19);
8355-
var EventProxy = __webpack_require__(3).EventProxy;
8353+
var EventProxy = __webpack_require__(2).EventProxy;
83568354
var util = __webpack_require__(0);
83578355

83588356
// 文件分块上传全过程,暴露的分块上传接口

‎dist/cos-js-sdk-v5.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cos-js-sdk-v5",
3-
"version": "1.1.8",
3+
"version": "1.1.9",
44
"description": "JavaScript SDK for [腾讯云对象存储](https://cloud.tencent.com/product/cos)",
55
"main": "index.js",
66
"types": "types",

‎src/cos.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ base.init(COS, task);
5959
advance.init(COS, task);
6060

6161
COS.getAuthorization = util.getAuth;
62-
COS.version = '1.1.8';
62+
COS.version = '1.1.9';
6363

6464
module.exports = COS;

‎src/util.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,7 @@ var apiWrapper = function (apiName, apiFn) {
486486

487487
var errMsg = checkParams();
488488
var isSync = apiName === 'getAuth' || apiName === 'getObjectUrl';
489-
var Promise = global.Promise;
490-
if (!isSync && Promise && !callback) {
489+
if (Promise && !isSync && !callback) {
491490
return new Promise(function (resolve, reject) {
492491
callback = function (err, data) {
493492
err ? reject(err) : resolve(data);

0 commit comments

Comments
 (0)
Please sign in to comment.