Skip to content

Conversation

fred-wang
Copy link
Contributor

…textContent

Setters for HTMLElement.innerText and Node.textContent can be retrieve via HTMLElement.prototype.__lookupSetter__('innerText') and Node.prototype.__lookupSetter__('textContent') respectively. New tests are added to make sure they allow to set the script source of a <script> element (without requiring to pass a TrustedScript) but that execution of such a script with modified source is blocked.

@fred-wang
Copy link
Contributor Author

This aligns with the spec and WebKit's behavior.

These tests are failing in Chromium because it always treat this the same as setting via HTMLScriptElement.innerText and HTMLScriptElement.textContent.

cc @otherdaniel @smaug----

@lukewarlow
Copy link
Member

Btw is lookupsetter the only way to do this? Given it's deprecated should we use something like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor instead. So modern engines can pass these tests without needed unrelated legacy stuff?

@fred-wang fred-wang force-pushed the tt-script-innerText-textContent-lookupSetter branch from ace6c4d to fb2e546 Compare August 27, 2025 14:58
@fred-wang
Copy link
Contributor Author

Btw is lookupsetter the only way to do this? Given it's deprecated should we use something like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor instead. So modern engines can pass these tests without needed unrelated legacy stuff?

Right, I guess I can replace with Object.getOwnPropertyDescriptor(HTMLElement.prototype, "innerText").set

@lukewarlow
Copy link
Member

I'm just a little conscious of the fact both ladybird and servo are mid TT implementation so it would be nice to avoid obsolete stuff where possible. But perhaps that ship has sailed.

…textContent

Setters for `HTMLElement.innerText` and `Node.textContent` can be retrieve via
`Object.getOwnPropertyDescriptor()`. New tests are added to make sure they
allow to set the script source of a `<script>` element (without requiring to
pass a `TrustedScript`) but that execution of such a script with modified
source is blocked.
@fred-wang fred-wang force-pushed the tt-script-innerText-textContent-lookupSetter branch from fb2e546 to 5f3fdaf Compare August 27, 2025 15:23
@fred-wang
Copy link
Contributor Author

I'm just a little conscious of the fact both ladybird and servo are mid TT implementation so it would be nice to avoid obsolete stuff where possible. But perhaps that ship has sailed.

Yeah that makes sense. I've rewritten the test with Object.getOwnPropertyDescriptor. I think we don't really care how we retrieve the setters anyway, the important part is about how TT implementations will behave when they are used on scripts. So let's pick the standard API.

Copy link

Uh oh! Looks like an error!

Client ID static/taskcluster/github does not have sufficient scopes and is missing the following scopes:

{
  "AnyOf": [
    "queue:rerun-task:taskcluster-github/WutXVwc0Qnu41CtdxoOJgA/WutXVwc0Qnu41CtdxoOJgA",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:taskcluster-github/WutXVwc0Qnu41CtdxoOJgA"
      ]
    }
  ]
}

This request requires the client to satisfy the following scope expression:

{
  "AnyOf": [
    "queue:rerun-task:taskcluster-github/WutXVwc0Qnu41CtdxoOJgA/WutXVwc0Qnu41CtdxoOJgA",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:taskcluster-github/WutXVwc0Qnu41CtdxoOJgA"
      ]
    }
  ]
}

  • method: rerunTask
  • errorCode: InsufficientScopes
  • statusCode: 403
  • time: 2025-08-28T07:16:50.773Z

Copy link

Uh oh! Looks like an error!

Client ID static/taskcluster/github does not have sufficient scopes and is missing the following scopes:

{
  "AnyOf": [
    "queue:rerun-task:taskcluster-github/WutXVwc0Qnu41CtdxoOJgA/WutXVwc0Qnu41CtdxoOJgA",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:taskcluster-github/WutXVwc0Qnu41CtdxoOJgA"
      ]
    }
  ]
}

This request requires the client to satisfy the following scope expression:

{
  "AnyOf": [
    "queue:rerun-task:taskcluster-github/WutXVwc0Qnu41CtdxoOJgA/WutXVwc0Qnu41CtdxoOJgA",
    "queue:rerun-task-in-project:none",
    {
      "AllOf": [
        "queue:rerun-task",
        "assume:scheduler-id:taskcluster-github/WutXVwc0Qnu41CtdxoOJgA"
      ]
    }
  ]
}

  • method: rerunTask
  • errorCode: InsufficientScopes
  • statusCode: 403
  • time: 2025-08-28T07:16:59.977Z

@fred-wang fred-wang closed this Aug 28, 2025
@fred-wang fred-wang reopened this Aug 28, 2025
@Ms2ger Ms2ger merged commit fa80f49 into master Aug 28, 2025
23 of 24 checks passed
@Ms2ger Ms2ger deleted the tt-script-innerText-textContent-lookupSetter branch August 28, 2025 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants