@arms/rum-core 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/utils/base.js CHANGED
@@ -10,6 +10,13 @@ export function interceptFunction(target, name, callback, isPrototype) {
10
10
  }
11
11
  try {
12
12
  var registeredMethod = target[name];
13
+ // 目标方法不存在时不注入空 wrapper:
14
+ // 空 wrapper 会覆盖 Behavior 提供的方法并使其静默失效,
15
+ // 且原函数为 undefined 时 disguiseProxy 不会安装 toString 伪装,
16
+ // 依赖注入等通过 fn.toString() 读取函数源码的场景将拿到 proxyMethod 源码
17
+ if (!isFunction(registeredMethod)) {
18
+ return;
19
+ }
13
20
  var proxyMethod = function proxyMethod() {
14
21
  var ctx = isPrototype ? this : target;
15
22
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
package/lib/utils/base.js CHANGED
@@ -21,6 +21,13 @@ function interceptFunction(target, name, callback, isPrototype) {
21
21
  }
22
22
  try {
23
23
  var registeredMethod = target[name];
24
+ // 目标方法不存在时不注入空 wrapper:
25
+ // 空 wrapper 会覆盖 Behavior 提供的方法并使其静默失效,
26
+ // 且原函数为 undefined 时 disguiseProxy 不会安装 toString 伪装,
27
+ // 依赖注入等通过 fn.toString() 读取函数源码的场景将拿到 proxyMethod 源码
28
+ if (!(0, _is.isFunction)(registeredMethod)) {
29
+ return;
30
+ }
24
31
  var proxyMethod = function proxyMethod() {
25
32
  var ctx = isPrototype ? this : target;
26
33
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arms/rum-core",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "arms rum javascript sdk core",
5
5
  "author": "guangli.fj <guangli.fj@alibaba-inc.com>",
6
6
  "license": "ISC",