window-global.js (4638B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 "use strict"; 5 6 const { 7 types, 8 generateActorSpec, 9 RetVal, 10 Option, 11 Arg, 12 } = require("resource://devtools/shared/protocol.js"); 13 14 types.addDictType("windowGlobalTarget.switchtoframe", { 15 message: "string", 16 }); 17 18 types.addDictType("windowGlobalTarget.listframes", { 19 frames: "array:windowGlobalTarget.window", 20 }); 21 22 types.addDictType("windowGlobalTarget.window", { 23 id: "string", 24 parentID: "nullable:string", 25 url: "nullable:string", // should be present if not destroying 26 title: "nullable:string", // should be present if not destroying 27 destroy: "nullable:boolean", // not present if not destroying 28 }); 29 30 types.addDictType("windowGlobalTarget.workers", { 31 workers: "array:workerDescriptor", 32 }); 33 34 // @backward-compat { legacy } 35 // reload is preserved for third party tools. See Bug 1717837. 36 // DevTools should use Descriptor::reloadDescriptor instead. 37 types.addDictType("windowGlobalTarget.reload", { 38 force: "boolean", 39 }); 40 41 // @backward-compat { version 87 } See backward-compat note for `reconfigure`. 42 types.addDictType("windowGlobalTarget.reconfigure", { 43 cacheDisabled: "nullable:boolean", 44 colorSchemeSimulation: "nullable:string", 45 printSimulationEnabled: "nullable:boolean", 46 restoreFocus: "nullable:boolean", 47 serviceWorkersTestingEnabled: "nullable:boolean", 48 }); 49 50 const windowGlobalTargetSpecPrototype = { 51 typeName: "windowGlobalTarget", 52 53 methods: { 54 detach: { 55 request: {}, 56 response: {}, 57 }, 58 focus: { 59 request: {}, 60 response: {}, 61 }, 62 goForward: { 63 request: {}, 64 response: {}, 65 }, 66 goBack: { 67 request: {}, 68 response: {}, 69 }, 70 // @backward-compat { legacy } 71 // reload is preserved for third party tools. See Bug 1717837. 72 // DevTools should use Descriptor::reloadDescriptor instead. 73 reload: { 74 request: { 75 options: Option(0, "windowGlobalTarget.reload"), 76 }, 77 response: {}, 78 }, 79 // @backward-compat { legacy } 80 // navigateTo is preserved for third party tools. See Bug 1717837. 81 // DevTools should use Descriptor::navigateTo instead. 82 navigateTo: { 83 request: { 84 url: Option(0, "string"), 85 }, 86 response: {}, 87 }, 88 // @backward-compat { version 87 } Starting with version 87, targets which 89 // support the watcher will rely on the configuration actor to update their 90 // configuration flags. However we need to keep this request until all 91 // browsing context targets support the watcher (eg webextensions). 92 reconfigure: { 93 request: { 94 options: Option(0, "windowGlobalTarget.reconfigure"), 95 }, 96 response: {}, 97 }, 98 switchToFrame: { 99 request: { 100 windowId: Option(0, "string"), 101 }, 102 response: RetVal("windowGlobalTarget.switchtoframe"), 103 }, 104 listFrames: { 105 request: {}, 106 response: RetVal("windowGlobalTarget.listframes"), 107 }, 108 listWorkers: { 109 request: {}, 110 response: RetVal("windowGlobalTarget.workers"), 111 }, 112 logInPage: { 113 request: { 114 text: Option(0, "string"), 115 category: Option(0, "string"), 116 flags: Option(0, "string"), 117 }, 118 response: {}, 119 }, 120 }, 121 events: { 122 tabNavigated: { 123 type: "tabNavigated", 124 url: Option(0, "string"), 125 title: Option(0, "string"), 126 state: Option(0, "string"), 127 isFrameSwitching: Option(0, "boolean"), 128 }, 129 frameUpdate: { 130 type: "frameUpdate", 131 frames: Option(0, "nullable:array:windowGlobalTarget.window"), 132 selected: Option(0, "nullable:number"), 133 destroyAll: Option(0, "nullable:boolean"), 134 }, 135 workerListChanged: { 136 type: "workerListChanged", 137 }, 138 contentScrolled: { 139 type: "contentScrolled", 140 deltaY: Arg(0, "number"), 141 }, 142 143 "resources-available-array": { 144 type: "resources-available-array", 145 array: Arg(0, "array:json"), 146 }, 147 "resources-destroyed-array": { 148 type: "resources-destroyed-array", 149 array: Arg(0, "array:json"), 150 }, 151 "resources-updated-array": { 152 type: "resources-updated-array", 153 array: Arg(0, "array:json"), 154 }, 155 }, 156 }; 157 158 const windowGlobalTargetSpec = generateActorSpec( 159 windowGlobalTargetSpecPrototype 160 ); 161 162 exports.windowGlobalTargetSpecPrototype = windowGlobalTargetSpecPrototype; 163 exports.windowGlobalTargetSpec = windowGlobalTargetSpec;