creepjs icon indicating copy to clipboard operation
creepjs copied to clipboard

what is ```- failed prototype test execution```

Open Kingkhan14 opened this issue 1 year ago • 9 comments

how its getting determined in a proxied object

- failed prototype test execution

Kingkhan14 avatar Oct 16 '23 20:10 Kingkhan14

It means that the test silently failed to complete due to an unforeseen error.

abrahamjuliot avatar Oct 16 '23 22:10 abrahamjuliot

like which error bro any examples

Kingkhan14 avatar Oct 17 '23 11:10 Kingkhan14

It can be any error produced by the client. There should be none. Are you seeing - failed prototype test execution in a clean browser?

abrahamjuliot avatar Oct 17 '23 14:10 abrahamjuliot

no only when using proxied object

Kingkhan14 avatar Oct 17 '23 14:10 Kingkhan14

get(target, ctx) {
      var methods = ["call", "bind", "apply", "toString", "string"];
      if(methods.includes(ctx)) {
          return target[ctx].bind(target);
      } else if(typeof ctx === 'symbol') {
          return target[ctx];
      } else {
          return target.bind(target);
      }
  }

like this when using proxy

Kingkhan14 avatar Oct 17 '23 14:10 Kingkhan14

I see. It's likely a side effect of the way that proxy object is written. I have no solution, but you can run the test script and log the error. Let's leave the issue open. I will set a task to auto log this error to the console.

abrahamjuliot avatar Oct 17 '23 15:10 abrahamjuliot

Ok will update

Kingkhan14 avatar Oct 17 '23 15:10 Kingkhan14

i believe

Object prototype may only be an Object or null: undefined
TypeError: Object prototype may only be an Object or null: undefined
    at Reflect.setPrototypeOf (<anonymous>)
    at Object.setPrototypeOf (<anonymous>:361:46)
    at Function.setPrototypeOf (<anonymous>)
    at getNullConversionTypeErrorLie (https://example.com/test.js:189:12)
    at getLies (https://example.com/test.js:534:39)
    at https://example.com/test.js:649:15
    at Array.forEach (<anonymous>)
    at searchLies (https://example.com/test.js:600:18)
    at getPrototypeLies (https://example.com/test.js:729:3)
    at https://example.com/test.js:772:58

this causing the issue

        try {
		const proto = obj.prototype ? obj.prototype : obj
		let res // response from getLies

		// search if function
		try {
			const apiFunction = proto[name] // may trigger TypeError
			if (typeof apiFunction == 'function') {
				res = getLies({
					apiFunction: proto[name],
					proto,
					lieProps: props
				})
				if (res.lied) {
					return (props[apiName] = res.lieTypes)
				}
				return
			}
			// since there is no TypeError and the typeof is not a function,
			// handle invalid values and ingnore name, length, and constants
			if (
				name != 'name' &&
				name != 'length' &&
				name[0] !== name[0].toUpperCase()) {
				const lie = [`failed descriptor.value undefined`]
				return (
					props[apiName] = lie
				)
			}
		} catch (error) { }
		// else search getter function
		const getterFunction = Object.getOwnPropertyDescriptor(proto, name).get
		res = getLies({
			apiFunction: getterFunction,
			proto,
			obj,
			lieProps: props
		}) // send the obj for special tests
		
		if (res.lied) {
			return (props[apiName] = res.lieTypes)
		}
		return
	} catch (error) {
		const lie = `failed prototype test execution`
		return (
			props[apiName] = [lie]
		)
	}

try block failed and triggered the error and when capturing the error above on the console

flen201 avatar Jan 20 '24 14:01 flen201

specifically this error happens only when the proxied is property like Navigator.prototype.platform but proxying other functions like Element.prototype.setAttribute not causing any errors

flen201 avatar Jan 20 '24 14:01 flen201