code: function resolve(resolver, value) {
          // 保证resolvePromise与rejectPromise
          // 只能被调用一次
          // （不确定value是否是Promise对象）
          // see #2.3.3.3.3
          var called;
  
          function onFulfilled(data) {
              if (!called) {
                  resolve(resolver, data);
                  called = true;
              }
          }
  
          function onRejected(reason) {
              if (!called) {
                  resolver.reject(reason);
                  called = true;
              }
          }
  
          function work() {
              var then;
              // 不再额外判断value是否是Promise对象
              if (isObject(value) || isFunction(value)) {
                  // 必须先保存对then对引用
                  // 官方的test spec中有检查对then的引用次数只能为1
                  then = value.then;
                  if (isFunction(then)) {
                      then.call(value, onFulfilled, onRejected);
                  }
                  else {
                      then = null;
                  }
              }
  
              if (!then) {
                  resolver.fulfill(value);
              }
          }
  
          if (captureException) {
              try {
                  work();
              }
              catch (e) {
                  if (!called) {
                      emitExceptionEvent(e);
                      resolver.reject(e);
                  }
              }
          }
          else {
              work();
          }
  
      }
docs: 使用value确定resolver的状态
  
  @param {Resolver} resolver resolver对象
  @param {Object} value 值