Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what is - failed prototype test execution #249

Open
Kingkhan14 opened this issue Oct 16, 2023 · 9 comments
Open

what is - failed prototype test execution #249

Kingkhan14 opened this issue Oct 16, 2023 · 9 comments

Comments

@Kingkhan14
Copy link

how its getting determined in a proxied object

- failed prototype test execution

@abrahamjuliot
Copy link
Owner

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

@Kingkhan14
Copy link
Author

like which error bro any examples

@abrahamjuliot
Copy link
Owner

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

@Kingkhan14
Copy link
Author

no only when using proxied object

@Kingkhan14
Copy link
Author

Kingkhan14 commented Oct 17, 2023

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

@abrahamjuliot
Copy link
Owner

abrahamjuliot commented Oct 17, 2023

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.

@Kingkhan14
Copy link
Author

Ok will update

@flen201
Copy link

flen201 commented Jan 20, 2024

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
Copy link

flen201 commented Jan 20, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants