Bug 1806598 - Part 6: Add Location accessors, window.location, and document.location to allowlist. r=nchevobbe

Location related accessors are not marked Pure, but some testcase expects
them to be eagerly evaluateable.

Differential Revision: https://phabricator.services.mozilla.com/D168340
This commit is contained in:
Tooru Fujisawa 2023-02-07 07:36:16 +00:00
parent 79d62c97fa
commit 748388bc15
3 changed files with 61 additions and 1 deletions

View File

@ -516,6 +516,20 @@ function ensureSideEffectFreeNatives(maybeEvalGlobal) {
"instance" in idlPureAllowlist.Window
) {
collectMethodsAndGetters(maybeEvalGlobal, idlPureAllowlist.Window.instance);
const maybeLocation = maybeEvalGlobal.location;
if (maybeLocation) {
collectMethodsAndGetters(
maybeLocation,
idlPureAllowlist.Location.instance
);
}
const maybeDocument = maybeEvalGlobal.document;
if (maybeDocument) {
collectMethodsAndGetters(
maybeDocument,
idlPureAllowlist.Document.instance
);
}
}
const natives = [

View File

@ -14,6 +14,9 @@ module.exports = {
},
},
Document: {
instance: {
getters: ["location"],
},
prototype: {
getters: [
"URL",
@ -118,6 +121,21 @@ module.exports = {
methods: ["entries", "keys", "values"],
},
},
Location: {
instance: {
getters: [
"href",
"origin",
"protocol",
"host",
"hostname",
"port",
"pathname",
"search",
"hash",
],
},
},
Node: {
prototype: {
getters: [
@ -183,6 +201,7 @@ module.exports = {
Window: {
instance: {
getters: [
"location",
"window",
"self",
"document",

View File

@ -81,12 +81,17 @@ results = parser.finish()
# TODO: Bug 1616013 - Move more of these to be part of the pure list.
pure_output = {
"Document": {
"instance": {
"getters": [
"location",
],
},
"prototype": {
"methods": [
"getSelection",
"hasStorageAccess",
],
}
},
},
"Range": {
"prototype": {
@ -107,6 +112,28 @@ pure_output = {
"methods": ["getRangeAt", "containsNode"],
}
},
"Window": {
"instance": {
"getters": [
"location",
],
},
},
"Location": {
"instance": {
"getters": [
"href",
"origin",
"protocol",
"host",
"hostname",
"port",
"pathname",
"search",
"hash",
],
},
},
}
deprecated_output = {}
for result in results: