/src/mozilla-central/dom/base/nsGlobalWindowInner.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef nsGlobalWindowInner_h___ |
8 | | #define nsGlobalWindowInner_h___ |
9 | | |
10 | | #include "nsPIDOMWindow.h" |
11 | | |
12 | | #include "nsHashKeys.h" |
13 | | #include "nsRefPtrHashtable.h" |
14 | | #include "nsInterfaceHashtable.h" |
15 | | |
16 | | // Local Includes |
17 | | // Helper Classes |
18 | | #include "nsCOMPtr.h" |
19 | | #include "nsAutoPtr.h" |
20 | | #include "nsWeakReference.h" |
21 | | #include "nsDataHashtable.h" |
22 | | #include "nsJSThingHashtable.h" |
23 | | #include "nsCycleCollectionParticipant.h" |
24 | | |
25 | | // Interfaces Needed |
26 | | #include "nsIBrowserDOMWindow.h" |
27 | | #include "nsIInterfaceRequestor.h" |
28 | | #include "nsIDOMChromeWindow.h" |
29 | | #include "nsIScriptGlobalObject.h" |
30 | | #include "nsIScriptObjectPrincipal.h" |
31 | | #include "nsITimer.h" |
32 | | #include "mozilla/EventListenerManager.h" |
33 | | #include "nsIPrincipal.h" |
34 | | #include "nsSize.h" |
35 | | #include "mozilla/FlushType.h" |
36 | | #include "prclist.h" |
37 | | #include "mozilla/dom/DOMPrefs.h" |
38 | | #include "mozilla/dom/BindingDeclarations.h" |
39 | | #include "mozilla/dom/ChromeMessageBroadcaster.h" |
40 | | #include "mozilla/dom/NavigatorBinding.h" |
41 | | #include "mozilla/dom/StorageEvent.h" |
42 | | #include "mozilla/dom/StorageEventBinding.h" |
43 | | #include "mozilla/dom/UnionTypes.h" |
44 | | #include "mozilla/ErrorResult.h" |
45 | | #include "mozilla/Attributes.h" |
46 | | #include "mozilla/GuardObjects.h" |
47 | | #include "mozilla/LinkedList.h" |
48 | | #include "mozilla/OwningNonNull.h" |
49 | | #include "mozilla/TimeStamp.h" |
50 | | #include "mozilla/webgpu/InstanceProvider.h" |
51 | | #include "nsWrapperCacheInlines.h" |
52 | | #include "nsIDocument.h" |
53 | | #include "mozilla/dom/EventTarget.h" |
54 | | #include "mozilla/dom/WindowBinding.h" |
55 | | #include "Units.h" |
56 | | #include "nsComponentManagerUtils.h" |
57 | | #include "nsSize.h" |
58 | | #include "nsCheapSets.h" |
59 | | #include "mozilla/dom/ImageBitmapSource.h" |
60 | | #include "mozilla/UniquePtr.h" |
61 | | #include "nsRefreshDriver.h" |
62 | | |
63 | | class nsIArray; |
64 | | class nsIBaseWindow; |
65 | | class nsIContent; |
66 | | class nsICSSDeclaration; |
67 | | class nsIDocShellTreeOwner; |
68 | | class nsIDOMWindowUtils; |
69 | | class nsDOMOfflineResourceList; |
70 | | class nsIScrollableFrame; |
71 | | class nsIControllers; |
72 | | class nsIJSID; |
73 | | class nsIScriptContext; |
74 | | class nsIScriptTimeoutHandler; |
75 | | class nsITabChild; |
76 | | class nsITimeoutHandler; |
77 | | class nsIWebBrowserChrome; |
78 | | class mozIDOMWindowProxy; |
79 | | |
80 | | class nsDOMWindowList; |
81 | | class nsScreen; |
82 | | class nsHistory; |
83 | | class nsGlobalWindowObserver; |
84 | | class nsGlobalWindowOuter; |
85 | | class nsDOMWindowUtils; |
86 | | class nsIIdleService; |
87 | | struct nsRect; |
88 | | |
89 | | class nsWindowSizes; |
90 | | |
91 | | class IdleRequestExecutor; |
92 | | |
93 | | class DialogValueHolder; |
94 | | |
95 | | class PromiseDocumentFlushedResolver; |
96 | | |
97 | | namespace mozilla { |
98 | | class AbstractThread; |
99 | | class ThrottledEventQueue; |
100 | | namespace dom { |
101 | | class BarProp; |
102 | | struct ChannelPixelLayout; |
103 | | class ClientSource; |
104 | | class Console; |
105 | | class Crypto; |
106 | | class CustomElementRegistry; |
107 | | class DocGroup; |
108 | | class External; |
109 | | class Function; |
110 | | class Gamepad; |
111 | | enum class ImageBitmapFormat : uint8_t; |
112 | | class IdleRequest; |
113 | | class IdleRequestCallback; |
114 | | class IncrementalRunnable; |
115 | | class InstallTriggerImpl; |
116 | | class IntlUtils; |
117 | | class Location; |
118 | | class MediaQueryList; |
119 | | class OwningExternalOrWindowProxy; |
120 | | class Promise; |
121 | | class PostMessageEvent; |
122 | | struct RequestInit; |
123 | | class RequestOrUSVString; |
124 | | class Selection; |
125 | | class SpeechSynthesis; |
126 | | class TabGroup; |
127 | | class Timeout; |
128 | | class U2F; |
129 | | class VisualViewport; |
130 | | class VRDisplay; |
131 | | enum class VRDisplayEventReason : uint8_t; |
132 | | class VREventObserver; |
133 | | class WakeLock; |
134 | | #if defined(MOZ_WIDGET_ANDROID) |
135 | | class WindowOrientationObserver; |
136 | | #endif |
137 | | class Worklet; |
138 | | namespace cache { |
139 | | class CacheStorage; |
140 | | } // namespace cache |
141 | | class IDBFactory; |
142 | | } // namespace dom |
143 | | } // namespace mozilla |
144 | | |
145 | | extern already_AddRefed<nsIScriptTimeoutHandler> |
146 | | NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindowInner *aWindow, |
147 | | mozilla::dom::Function& aFunction, |
148 | | const mozilla::dom::Sequence<JS::Value>& aArguments, |
149 | | mozilla::ErrorResult& aError); |
150 | | |
151 | | extern already_AddRefed<nsIScriptTimeoutHandler> |
152 | | NS_CreateJSTimeoutHandler(JSContext* aCx, nsGlobalWindowInner *aWindow, |
153 | | const nsAString& aExpression, |
154 | | mozilla::ErrorResult& aError); |
155 | | |
156 | | extern const js::Class OuterWindowProxyClass; |
157 | | |
158 | | struct IdleObserverHolder |
159 | | { |
160 | | mozilla::OwningNonNull<mozilla::dom::MozIdleObserver> mIdleObserver; |
161 | | uint32_t mTimeInS; |
162 | | bool mPrevNotificationIdle; |
163 | | |
164 | | IdleObserverHolder() |
165 | | : mTimeInS(0), mPrevNotificationIdle(false) |
166 | 0 | { |
167 | 0 | MOZ_COUNT_CTOR(IdleObserverHolder); |
168 | 0 | } |
169 | | |
170 | | IdleObserverHolder(const IdleObserverHolder& aOther) |
171 | | : mIdleObserver(aOther.mIdleObserver), mTimeInS(aOther.mTimeInS), |
172 | | mPrevNotificationIdle(aOther.mPrevNotificationIdle) |
173 | 0 | { |
174 | 0 | MOZ_COUNT_CTOR(IdleObserverHolder); |
175 | 0 | } |
176 | | |
177 | 0 | bool operator==(const IdleObserverHolder& aOther) const { |
178 | 0 | return |
179 | 0 | mIdleObserver.ref() == aOther.mIdleObserver && |
180 | 0 | mTimeInS == aOther.mTimeInS; |
181 | 0 | } |
182 | | |
183 | | ~IdleObserverHolder() |
184 | 0 | { |
185 | 0 | MOZ_COUNT_DTOR(IdleObserverHolder); |
186 | 0 | } |
187 | | }; |
188 | | |
189 | | inline void |
190 | | ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, |
191 | | IdleObserverHolder& aField, |
192 | | const char* aName, |
193 | | unsigned aFlags) |
194 | 0 | { |
195 | 0 | CycleCollectionNoteChild(aCallback, aField.mIdleObserver.get(), aName, aFlags); |
196 | 0 | } |
197 | | |
198 | | //***************************************************************************** |
199 | | // nsGlobalWindowInner: Global Object for Scripting |
200 | | //***************************************************************************** |
201 | | |
202 | | // nsGlobalWindowInner inherits PRCList for maintaining a list of all inner |
203 | | // windows still in memory for any given outer window. This list is needed to |
204 | | // ensure that mOuterWindow doesn't end up dangling. The nature of PRCList means |
205 | | // that the window itself is always in the list, and an outer window's list will |
206 | | // also contain all inner window objects that are still in memory (and in |
207 | | // reality all inner window object's lists also contain its outer and all other |
208 | | // inner windows belonging to the same outer window, but that's an unimportant |
209 | | // side effect of inheriting PRCList). |
210 | | |
211 | | class nsGlobalWindowInner final |
212 | | : public mozilla::dom::EventTarget |
213 | | , public nsPIDOMWindowInner |
214 | | , private nsIDOMWindow |
215 | | // NOTE: This interface is private, as it's only |
216 | | // implemented on chrome windows. |
217 | | , private nsIDOMChromeWindow |
218 | | , public nsIScriptGlobalObject |
219 | | , public nsIScriptObjectPrincipal |
220 | | , public nsSupportsWeakReference |
221 | | , public nsIInterfaceRequestor |
222 | | , public PRCListStr |
223 | | , public nsAPostRefreshObserver |
224 | | , public mozilla::webgpu::InstanceProvider |
225 | | { |
226 | | public: |
227 | | typedef mozilla::TimeStamp TimeStamp; |
228 | | typedef mozilla::TimeDuration TimeDuration; |
229 | | |
230 | | typedef nsDataHashtable<nsUint64HashKey, nsGlobalWindowInner*> InnerWindowByIdTable; |
231 | | |
232 | | static void |
233 | | AssertIsOnMainThread() |
234 | | #ifdef DEBUG |
235 | | ; |
236 | | #else |
237 | 3 | { } |
238 | | #endif |
239 | | |
240 | 0 | static nsGlobalWindowInner* Cast(nsPIDOMWindowInner* aPIWin) { |
241 | 0 | return static_cast<nsGlobalWindowInner*>(aPIWin); |
242 | 0 | } |
243 | 0 | static const nsGlobalWindowInner* Cast(const nsPIDOMWindowInner* aPIWin) { |
244 | 0 | return static_cast<const nsGlobalWindowInner*>(aPIWin); |
245 | 0 | } |
246 | 0 | static nsGlobalWindowInner* Cast(mozIDOMWindow* aWin) { |
247 | 0 | return Cast(nsPIDOMWindowInner::From(aWin)); |
248 | 0 | } |
249 | | |
250 | | static nsGlobalWindowInner* |
251 | | GetInnerWindowWithId(uint64_t aInnerWindowID) |
252 | 0 | { |
253 | 0 | AssertIsOnMainThread(); |
254 | 0 |
|
255 | 0 | if (!sInnerWindowsById) { |
256 | 0 | return nullptr; |
257 | 0 | } |
258 | 0 | |
259 | 0 | nsGlobalWindowInner* innerWindow = |
260 | 0 | sInnerWindowsById->Get(aInnerWindowID); |
261 | 0 | return innerWindow; |
262 | 0 | } |
263 | | |
264 | 0 | static InnerWindowByIdTable* GetWindowsTable() { |
265 | 0 | AssertIsOnMainThread(); |
266 | 0 |
|
267 | 0 | return sInnerWindowsById; |
268 | 0 | } |
269 | | |
270 | | static nsGlobalWindowInner *FromSupports(nsISupports *supports) |
271 | 0 | { |
272 | 0 | // Make sure this matches the casts we do in QueryInterface(). |
273 | 0 | return (nsGlobalWindowInner *)(mozilla::dom::EventTarget *)supports; |
274 | 0 | } |
275 | | |
276 | | static already_AddRefed<nsGlobalWindowInner> |
277 | | Create(nsGlobalWindowOuter* aOuter, bool aIsChrome); |
278 | | |
279 | | // nsISupports |
280 | | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
281 | | |
282 | | // nsWrapperCache |
283 | | virtual JSObject *WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override |
284 | 0 | { |
285 | 0 | return GetWrapper(); |
286 | 0 | } |
287 | | |
288 | | // nsIGlobalJSObjectHolder |
289 | | virtual JSObject* GetGlobalJSObject() override; |
290 | | |
291 | | // nsIScriptGlobalObject |
292 | | JSObject *FastGetGlobalJSObject() const |
293 | 0 | { |
294 | 0 | return GetWrapperPreserveColor(); |
295 | 0 | } |
296 | | |
297 | | void TraceGlobalJSObject(JSTracer* aTrc); |
298 | | |
299 | | virtual nsresult EnsureScriptEnvironment() override; |
300 | | |
301 | | virtual nsIScriptContext *GetScriptContext() override; |
302 | | |
303 | | virtual bool IsBlackForCC(bool aTracingNeeded = true) override; |
304 | | |
305 | | // nsIScriptObjectPrincipal |
306 | | virtual nsIPrincipal* GetPrincipal() override; |
307 | | |
308 | | // nsIDOMWindow |
309 | | NS_DECL_NSIDOMWINDOW |
310 | | |
311 | | // nsIDOMChromeWindow (only implemented on chrome windows) |
312 | | NS_DECL_NSIDOMCHROMEWINDOW |
313 | | |
314 | | void CaptureEvents(); |
315 | | void ReleaseEvents(); |
316 | | void Dump(const nsAString& aStr); |
317 | | void SetResizable(bool aResizable) const; |
318 | | |
319 | | virtual mozilla::EventListenerManager* |
320 | | GetExistingListenerManager() const override; |
321 | | |
322 | | virtual mozilla::EventListenerManager* |
323 | | GetOrCreateListenerManager() override; |
324 | | |
325 | | bool ComputeDefaultWantsUntrusted(mozilla::ErrorResult& aRv) final; |
326 | | |
327 | | virtual nsPIDOMWindowOuter* GetOwnerGlobalForBindings() override; |
328 | | |
329 | | virtual nsIGlobalObject* GetOwnerGlobal() const override; |
330 | | |
331 | | EventTarget* GetTargetForDOMEvent() override; |
332 | | |
333 | | using mozilla::dom::EventTarget::DispatchEvent; |
334 | | bool DispatchEvent(mozilla::dom::Event& aEvent, |
335 | | mozilla::dom::CallerType aCallerType, |
336 | | mozilla::ErrorResult& aRv) override; |
337 | | |
338 | | void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override; |
339 | | |
340 | | nsresult PostHandleEvent(mozilla::EventChainPostVisitor& aVisitor) override; |
341 | | |
342 | | // nsPIDOMWindow |
343 | | virtual nsPIDOMWindowOuter* GetPrivateRoot() override; |
344 | | |
345 | | // Outer windows only. |
346 | | virtual bool IsTopLevelWindowActive() override; |
347 | | |
348 | | virtual PopupControlState GetPopupControlState() const override; |
349 | | |
350 | | void Suspend(); |
351 | | void Resume(); |
352 | | virtual bool IsSuspended() const override; |
353 | | |
354 | | // Calling Freeze() on a window will automatically Suspend() it. In |
355 | | // addition, the window and its children are further treated as no longer |
356 | | // suitable for interaction with the user. For example, it may be marked |
357 | | // non-visible, cannot be focused, etc. All worker threads are also frozen |
358 | | // bringing them to a complete stop. A window can have Freeze() called |
359 | | // multiple times and will only thaw after a matching number of Thaw() |
360 | | // calls. |
361 | | void Freeze(); |
362 | | void Thaw(); |
363 | | virtual bool IsFrozen() const override; |
364 | | void SyncStateFromParentWindow(); |
365 | | |
366 | | mozilla::Maybe<mozilla::dom::ClientInfo> GetClientInfo() const override; |
367 | | mozilla::Maybe<mozilla::dom::ClientState> GetClientState() const; |
368 | | mozilla::Maybe<mozilla::dom::ServiceWorkerDescriptor> GetController() const override; |
369 | | |
370 | | virtual RefPtr<mozilla::dom::ServiceWorker> |
371 | | GetOrCreateServiceWorker(const mozilla::dom::ServiceWorkerDescriptor& aDescriptor) override; |
372 | | |
373 | | RefPtr<mozilla::dom::ServiceWorkerRegistration> |
374 | | GetServiceWorkerRegistration(const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor) const override; |
375 | | |
376 | | RefPtr<mozilla::dom::ServiceWorkerRegistration> |
377 | | GetOrCreateServiceWorkerRegistration(const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor) override; |
378 | | |
379 | | void NoteCalledRegisterForServiceWorkerScope(const nsACString& aScope); |
380 | | |
381 | | void NoteDOMContentLoaded(); |
382 | | |
383 | | virtual nsresult FireDelayedDOMEvents() override; |
384 | | |
385 | | virtual nsresult SetNewDocument(nsIDocument *aDocument, |
386 | | nsISupports *aState, |
387 | | bool aForceReuseInnerWindow) override; |
388 | | |
389 | | virtual void SetOpenerWindow(nsPIDOMWindowOuter* aOpener, |
390 | | bool aOriginalOpener) override; |
391 | | |
392 | | virtual void MaybeUpdateTouchState() override; |
393 | | |
394 | | // Inner windows only. |
395 | | void RefreshRealmPrincipal(); |
396 | | |
397 | | // For accessing protected field mFullscreen |
398 | | friend class FullscreenTransitionTask; |
399 | | |
400 | | // Inner windows only. |
401 | | virtual void SetHasGamepadEventListener(bool aHasGamepad = true) override; |
402 | | void NotifyVREventListenerAdded(); |
403 | | bool HasUsedVR() const; |
404 | | bool IsVRContentDetected() const; |
405 | | bool IsVRContentPresenting() const; |
406 | | |
407 | | using EventTarget::EventListenerAdded; |
408 | | virtual void EventListenerAdded(nsAtom* aType) override; |
409 | | using EventTarget::EventListenerRemoved; |
410 | | virtual void EventListenerRemoved(nsAtom* aType) override; |
411 | | |
412 | | // nsIInterfaceRequestor |
413 | | NS_DECL_NSIINTERFACEREQUESTOR |
414 | | |
415 | | // WebIDL interface. |
416 | | already_AddRefed<nsPIDOMWindowOuter> IndexedGetter(uint32_t aIndex); |
417 | | |
418 | | static bool IsPrivilegedChromeWindow(JSContext* /* unused */, JSObject* aObj); |
419 | | |
420 | | static bool OfflineCacheAllowedForContext(JSContext* /* unused */, JSObject* aObj); |
421 | | |
422 | | static bool IsRequestIdleCallbackEnabled(JSContext* aCx, JSObject* /* unused */); |
423 | | |
424 | | static bool IsWindowPrintEnabled(JSContext* /* unused */, JSObject* /* unused */); |
425 | | |
426 | | static bool RegisterProtocolHandlerAllowedForContext(JSContext* /* unused */, JSObject* aObj); |
427 | | |
428 | | static bool DeviceSensorsEnabled(JSContext* /* unused */, JSObject* aObj); |
429 | | |
430 | | bool DoResolve(JSContext* aCx, JS::Handle<JSObject*> aObj, |
431 | | JS::Handle<jsid> aId, |
432 | | JS::MutableHandle<JS::PropertyDescriptor> aDesc); |
433 | | // The return value is whether DoResolve might end up resolving the given id. |
434 | | // If in doubt, return true. |
435 | | static bool MayResolve(jsid aId); |
436 | | |
437 | | void GetOwnPropertyNames(JSContext* aCx, JS::AutoIdVector& aNames, |
438 | | bool aEnumerableOnly, mozilla::ErrorResult& aRv); |
439 | | |
440 | | nsPIDOMWindowOuter* GetScriptableTop() override; |
441 | | inline nsGlobalWindowOuter *GetTopInternal(); |
442 | | |
443 | | inline nsGlobalWindowOuter* GetScriptableTopInternal(); |
444 | | |
445 | | nsPIDOMWindowOuter* GetChildWindow(const nsAString& aName); |
446 | | |
447 | | // These return true if we've reached the state in this top level window |
448 | | // where we ask the user if further dialogs should be blocked. |
449 | | // |
450 | | // DialogsAreBeingAbused must be called on the scriptable top inner window. |
451 | | // |
452 | | // nsGlobalWindowOuter::ShouldPromptToBlockDialogs is implemented in terms of |
453 | | // nsGlobalWindowInner::DialogsAreBeingAbused, and will get the scriptable top inner window |
454 | | // automatically. |
455 | | // Inner windows only. |
456 | | bool DialogsAreBeingAbused(); |
457 | | |
458 | | nsIScriptContext *GetContextInternal(); |
459 | | |
460 | | nsGlobalWindowOuter *GetOuterWindowInternal() const; |
461 | | |
462 | | bool IsChromeWindow() const |
463 | 0 | { |
464 | 0 | return mIsChrome; |
465 | 0 | } |
466 | | |
467 | | // GetScrollFrame does not flush. Callers should do it themselves as needed, |
468 | | // depending on which info they actually want off the scrollable frame. |
469 | | nsIScrollableFrame *GetScrollFrame(); |
470 | | |
471 | | nsresult Observe(nsISupports* aSubject, const char* aTopic, |
472 | | const char16_t* aData); |
473 | | |
474 | | void ObserveStorageNotification(mozilla::dom::StorageEvent* aEvent, |
475 | | const char16_t* aStorageType, |
476 | | bool aPrivateBrowsing); |
477 | | |
478 | | static void Init(); |
479 | | static void ShutDown(); |
480 | | static bool IsCallerChrome(); |
481 | | |
482 | | void CleanupCachedXBLHandlers(); |
483 | | |
484 | | friend class WindowStateHolder; |
485 | | |
486 | | NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsGlobalWindowInner, |
487 | | mozilla::dom::EventTarget) |
488 | | |
489 | | #ifdef DEBUG |
490 | | // Call Unlink on this window. This may cause bad things to happen, so use |
491 | | // with caution. |
492 | | void RiskyUnlink(); |
493 | | #endif |
494 | | |
495 | | virtual JSObject* |
496 | | GetCachedXBLPrototypeHandler(nsXBLPrototypeHandler* aKey) override; |
497 | | |
498 | | virtual void |
499 | | CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey, |
500 | | JS::Handle<JSObject*> aHandler) override; |
501 | | |
502 | | virtual bool TakeFocus(bool aFocus, uint32_t aFocusMethod) override; |
503 | | virtual void SetReadyForFocus() override; |
504 | | virtual void PageHidden() override; |
505 | | virtual nsresult DispatchAsyncHashchange(nsIURI *aOldURI, nsIURI *aNewURI) override; |
506 | | virtual nsresult DispatchSyncPopState() override; |
507 | | |
508 | | // Inner windows only. |
509 | | virtual void EnableDeviceSensor(uint32_t aType) override; |
510 | | virtual void DisableDeviceSensor(uint32_t aType) override; |
511 | | |
512 | | #if defined(MOZ_WIDGET_ANDROID) |
513 | | virtual void EnableOrientationChangeListener() override; |
514 | | virtual void DisableOrientationChangeListener() override; |
515 | | #endif |
516 | | |
517 | 0 | virtual uint32_t GetSerial() override { |
518 | 0 | return mSerial; |
519 | 0 | } |
520 | | |
521 | | void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const; |
522 | | |
523 | | void NotifyIdleObserver(IdleObserverHolder* aIdleObserverHolder, |
524 | | bool aCallOnidle); |
525 | | nsresult HandleIdleActiveEvent(); |
526 | | bool ContainsIdleObserver(mozilla::dom::MozIdleObserver& aIdleObserver, |
527 | | uint32_t timeInS); |
528 | | void HandleIdleObserverCallback(); |
529 | | |
530 | | enum SlowScriptResponse { |
531 | | ContinueSlowScript = 0, |
532 | | ContinueSlowScriptAndKeepNotifying, |
533 | | AlwaysContinueSlowScript, |
534 | | KillSlowScript, |
535 | | KillScriptGlobal |
536 | | }; |
537 | | SlowScriptResponse ShowSlowScriptDialog(const nsString& aAddonId); |
538 | | |
539 | | // Inner windows only. |
540 | | void AddGamepad(uint32_t aIndex, mozilla::dom::Gamepad* aGamepad); |
541 | | void RemoveGamepad(uint32_t aIndex); |
542 | | void GetGamepads(nsTArray<RefPtr<mozilla::dom::Gamepad> >& aGamepads); |
543 | | already_AddRefed<mozilla::dom::Gamepad> GetGamepad(uint32_t aIndex); |
544 | | void SetHasSeenGamepadInput(bool aHasSeen); |
545 | | bool HasSeenGamepadInput(); |
546 | | void SyncGamepadState(); |
547 | | void StopGamepadHaptics(); |
548 | | |
549 | | // Inner windows only. |
550 | | // Enable/disable updates for gamepad input. |
551 | | void EnableGamepadUpdates(); |
552 | | void DisableGamepadUpdates(); |
553 | | |
554 | | // Inner windows only. |
555 | | // Enable/disable updates for VR |
556 | | void EnableVRUpdates(); |
557 | | void DisableVRUpdates(); |
558 | | // Reset telemetry data when switching windows. |
559 | | // aUpdate, true for accumulating the result to the histogram. |
560 | | // false for only resetting the timestamp. |
561 | | void ResetVRTelemetry(bool aUpdate); |
562 | | |
563 | | // Update the VR displays for this window |
564 | | bool UpdateVRDisplays(nsTArray<RefPtr<mozilla::dom::VRDisplay>>& aDisplays); |
565 | | |
566 | | // Inner windows only. |
567 | | // Called to inform that the set of active VR displays has changed. |
568 | | void NotifyActiveVRDisplaysChanged(); |
569 | | void NotifyPresentationGenerationChanged(uint32_t aDisplayID); |
570 | | |
571 | | void DispatchVRDisplayActivate(uint32_t aDisplayID, |
572 | | mozilla::dom::VRDisplayEventReason aReason); |
573 | | void DispatchVRDisplayDeactivate(uint32_t aDisplayID, |
574 | | mozilla::dom::VRDisplayEventReason aReason); |
575 | | void DispatchVRDisplayConnect(uint32_t aDisplayID); |
576 | | void DispatchVRDisplayDisconnect(uint32_t aDisplayID); |
577 | | void DispatchVRDisplayPresentChange(uint32_t aDisplayID); |
578 | | |
579 | | #define EVENT(name_, id_, type_, struct_) \ |
580 | | mozilla::dom::EventHandlerNonNull* GetOn##name_() \ |
581 | 0 | { \ |
582 | 0 | mozilla::EventListenerManager* elm = GetExistingListenerManager(); \ |
583 | 0 | return elm ? elm->GetEventHandler(nsGkAtoms::on##name_) : nullptr; \ |
584 | 0 | } \ Unexecuted instantiation: nsGlobalWindowInner::GetOnabort() Unexecuted instantiation: nsGlobalWindowInner::GetOncanplay() Unexecuted instantiation: nsGlobalWindowInner::GetOncanplaythrough() Unexecuted instantiation: nsGlobalWindowInner::GetOnchange() Unexecuted instantiation: nsGlobalWindowInner::GetOnCheckboxStateChange() Unexecuted instantiation: nsGlobalWindowInner::GetOnRadioStateChange() Unexecuted instantiation: nsGlobalWindowInner::GetOnauxclick() Unexecuted instantiation: nsGlobalWindowInner::GetOnclick() Unexecuted instantiation: nsGlobalWindowInner::GetOnclose() Unexecuted instantiation: nsGlobalWindowInner::GetOncontextmenu() Unexecuted instantiation: nsGlobalWindowInner::GetOndblclick() Unexecuted instantiation: nsGlobalWindowInner::GetOndrag() Unexecuted instantiation: nsGlobalWindowInner::GetOndragend() Unexecuted instantiation: nsGlobalWindowInner::GetOndragenter() Unexecuted instantiation: nsGlobalWindowInner::GetOndragexit() Unexecuted instantiation: nsGlobalWindowInner::GetOndragleave() Unexecuted instantiation: nsGlobalWindowInner::GetOndragover() Unexecuted instantiation: nsGlobalWindowInner::GetOndragstart() Unexecuted instantiation: nsGlobalWindowInner::GetOndrop() Unexecuted instantiation: nsGlobalWindowInner::GetOndurationchange() Unexecuted instantiation: nsGlobalWindowInner::GetOnemptied() Unexecuted instantiation: nsGlobalWindowInner::GetOnended() Unexecuted instantiation: nsGlobalWindowInner::GetOnfullscreenchange() Unexecuted instantiation: nsGlobalWindowInner::GetOnfullscreenerror() Unexecuted instantiation: nsGlobalWindowInner::GetOninput() Unexecuted instantiation: nsGlobalWindowInner::GetOninvalid() Unexecuted instantiation: nsGlobalWindowInner::GetOnkeydown() Unexecuted instantiation: nsGlobalWindowInner::GetOnkeypress() Unexecuted instantiation: nsGlobalWindowInner::GetOnkeyup() Unexecuted instantiation: nsGlobalWindowInner::GetOnmozkeydownonplugin() Unexecuted instantiation: nsGlobalWindowInner::GetOnmozkeyuponplugin() Unexecuted instantiation: nsGlobalWindowInner::GetOnloadeddata() Unexecuted instantiation: nsGlobalWindowInner::GetOnloadedmetadata() Unexecuted instantiation: nsGlobalWindowInner::GetOnloadend() Unexecuted instantiation: nsGlobalWindowInner::GetOnloadstart() Unexecuted instantiation: nsGlobalWindowInner::GetOnmousedown() Unexecuted instantiation: nsGlobalWindowInner::GetOnmouseenter() Unexecuted instantiation: nsGlobalWindowInner::GetOnmouseleave() Unexecuted instantiation: nsGlobalWindowInner::GetOnmousemove() Unexecuted instantiation: nsGlobalWindowInner::GetOnmouseout() Unexecuted instantiation: nsGlobalWindowInner::GetOnmouseover() Unexecuted instantiation: nsGlobalWindowInner::GetOnmouseup() Unexecuted instantiation: nsGlobalWindowInner::GetOnmozfullscreenchange() Unexecuted instantiation: nsGlobalWindowInner::GetOnmozfullscreenerror() Unexecuted instantiation: nsGlobalWindowInner::GetOnmozpointerlockchange() Unexecuted instantiation: nsGlobalWindowInner::GetOnmozpointerlockerror() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointerlockchange() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointerlockerror() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointerdown() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointermove() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointerup() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointercancel() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointerover() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointerout() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointerenter() Unexecuted instantiation: nsGlobalWindowInner::GetOnpointerleave() Unexecuted instantiation: nsGlobalWindowInner::GetOngotpointercapture() Unexecuted instantiation: nsGlobalWindowInner::GetOnlostpointercapture() Unexecuted instantiation: nsGlobalWindowInner::GetOnselectstart() Unexecuted instantiation: nsGlobalWindowInner::GetOnpause() Unexecuted instantiation: nsGlobalWindowInner::GetOnplay() Unexecuted instantiation: nsGlobalWindowInner::GetOnplaying() Unexecuted instantiation: nsGlobalWindowInner::GetOnprogress() Unexecuted instantiation: nsGlobalWindowInner::GetOnratechange() Unexecuted instantiation: nsGlobalWindowInner::GetOnreset() Unexecuted instantiation: nsGlobalWindowInner::GetOnseeked() Unexecuted instantiation: nsGlobalWindowInner::GetOnseeking() Unexecuted instantiation: nsGlobalWindowInner::GetOnselect() Unexecuted instantiation: nsGlobalWindowInner::GetOnshow() Unexecuted instantiation: nsGlobalWindowInner::GetOnstalled() Unexecuted instantiation: nsGlobalWindowInner::GetOnsubmit() Unexecuted instantiation: nsGlobalWindowInner::GetOnsuspend() Unexecuted instantiation: nsGlobalWindowInner::GetOntimeupdate() Unexecuted instantiation: nsGlobalWindowInner::GetOntoggle() Unexecuted instantiation: nsGlobalWindowInner::GetOnvolumechange() Unexecuted instantiation: nsGlobalWindowInner::GetOnwaiting() Unexecuted instantiation: nsGlobalWindowInner::GetOnwheel() Unexecuted instantiation: nsGlobalWindowInner::GetOncopy() Unexecuted instantiation: nsGlobalWindowInner::GetOncut() Unexecuted instantiation: nsGlobalWindowInner::GetOnpaste() Unexecuted instantiation: nsGlobalWindowInner::GetOnbeforescriptexecute() Unexecuted instantiation: nsGlobalWindowInner::GetOnafterscriptexecute() Unexecuted instantiation: nsGlobalWindowInner::GetOnblur() Unexecuted instantiation: nsGlobalWindowInner::GetOnfocus() Unexecuted instantiation: nsGlobalWindowInner::GetOnfocusin() Unexecuted instantiation: nsGlobalWindowInner::GetOnfocusout() Unexecuted instantiation: nsGlobalWindowInner::GetOnload() Unexecuted instantiation: nsGlobalWindowInner::GetOnresize() Unexecuted instantiation: nsGlobalWindowInner::GetOnscroll() Unexecuted instantiation: nsGlobalWindowInner::GetOnafterprint() Unexecuted instantiation: nsGlobalWindowInner::GetOnbeforeprint() Unexecuted instantiation: nsGlobalWindowInner::GetOnhashchange() Unexecuted instantiation: nsGlobalWindowInner::GetOnlanguagechange() Unexecuted instantiation: nsGlobalWindowInner::GetOnmessage() Unexecuted instantiation: nsGlobalWindowInner::GetOnmessageerror() Unexecuted instantiation: nsGlobalWindowInner::GetOnoffline() Unexecuted instantiation: nsGlobalWindowInner::GetOnonline() Unexecuted instantiation: nsGlobalWindowInner::GetOnpagehide() Unexecuted instantiation: nsGlobalWindowInner::GetOnpageshow() Unexecuted instantiation: nsGlobalWindowInner::GetOnpopstate() Unexecuted instantiation: nsGlobalWindowInner::GetOnstorage() Unexecuted instantiation: nsGlobalWindowInner::GetOnunload() Unexecuted instantiation: nsGlobalWindowInner::GetOndevicemotion() Unexecuted instantiation: nsGlobalWindowInner::GetOndeviceorientation() Unexecuted instantiation: nsGlobalWindowInner::GetOnabsolutedeviceorientation() Unexecuted instantiation: nsGlobalWindowInner::GetOndeviceproximity() Unexecuted instantiation: nsGlobalWindowInner::GetOnuserproximity() Unexecuted instantiation: nsGlobalWindowInner::GetOndevicelight() Unexecuted instantiation: nsGlobalWindowInner::GetOnvrdisplayactivate() Unexecuted instantiation: nsGlobalWindowInner::GetOnvrdisplaydeactivate() Unexecuted instantiation: nsGlobalWindowInner::GetOnvrdisplayconnect() Unexecuted instantiation: nsGlobalWindowInner::GetOnvrdisplaydisconnect() Unexecuted instantiation: nsGlobalWindowInner::GetOnvrdisplaypresentchange() Unexecuted instantiation: nsGlobalWindowInner::GetOnappinstalled() Unexecuted instantiation: nsGlobalWindowInner::GetOntouchstart() Unexecuted instantiation: nsGlobalWindowInner::GetOntouchend() Unexecuted instantiation: nsGlobalWindowInner::GetOntouchmove() Unexecuted instantiation: nsGlobalWindowInner::GetOntouchcancel() Unexecuted instantiation: nsGlobalWindowInner::GetOntransitionstart() Unexecuted instantiation: nsGlobalWindowInner::GetOntransitionrun() Unexecuted instantiation: nsGlobalWindowInner::GetOntransitionend() Unexecuted instantiation: nsGlobalWindowInner::GetOntransitioncancel() Unexecuted instantiation: nsGlobalWindowInner::GetOnanimationstart() Unexecuted instantiation: nsGlobalWindowInner::GetOnanimationend() Unexecuted instantiation: nsGlobalWindowInner::GetOnanimationiteration() Unexecuted instantiation: nsGlobalWindowInner::GetOnanimationcancel() Unexecuted instantiation: nsGlobalWindowInner::GetOnwebkitAnimationEnd() Unexecuted instantiation: nsGlobalWindowInner::GetOnwebkitAnimationIteration() Unexecuted instantiation: nsGlobalWindowInner::GetOnwebkitAnimationStart() Unexecuted instantiation: nsGlobalWindowInner::GetOnwebkitTransitionEnd() Unexecuted instantiation: nsGlobalWindowInner::GetOnwebkitanimationend() Unexecuted instantiation: nsGlobalWindowInner::GetOnwebkitanimationiteration() Unexecuted instantiation: nsGlobalWindowInner::GetOnwebkitanimationstart() Unexecuted instantiation: nsGlobalWindowInner::GetOnwebkittransitionend() |
585 | | void SetOn##name_(mozilla::dom::EventHandlerNonNull* handler) \ |
586 | 0 | { \ |
587 | 0 | mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \ |
588 | 0 | if (elm) { \ |
589 | 0 | elm->SetEventHandler(nsGkAtoms::on##name_, handler); \ |
590 | 0 | } \ |
591 | 0 | } Unexecuted instantiation: nsGlobalWindowInner::SetOnabort(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOncanplay(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOncanplaythrough(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnchange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnCheckboxStateChange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnRadioStateChange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnauxclick(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnclick(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnclose(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOncontextmenu(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndblclick(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndrag(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndragend(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndragenter(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndragexit(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndragleave(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndragover(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndragstart(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndrop(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndurationchange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnemptied(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnended(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnfullscreenchange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnfullscreenerror(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOninput(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOninvalid(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnkeydown(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnkeypress(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnkeyup(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmozkeydownonplugin(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmozkeyuponplugin(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnloadeddata(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnloadedmetadata(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnloadend(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnloadstart(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmousedown(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmouseenter(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmouseleave(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmousemove(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmouseout(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmouseover(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmouseup(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmozfullscreenchange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmozfullscreenerror(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmozpointerlockchange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmozpointerlockerror(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointerlockchange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointerlockerror(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointerdown(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointermove(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointerup(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointercancel(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointerover(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointerout(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointerenter(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpointerleave(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOngotpointercapture(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnlostpointercapture(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnselectstart(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpause(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnplay(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnplaying(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnprogress(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnratechange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnreset(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnseeked(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnseeking(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnselect(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnshow(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnstalled(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnsubmit(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnsuspend(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntimeupdate(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntoggle(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnvolumechange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwaiting(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwheel(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOncopy(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOncut(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpaste(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnbeforescriptexecute(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnafterscriptexecute(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnblur(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnfocus(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnfocusin(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnfocusout(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnload(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnresize(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnscroll(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnafterprint(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnbeforeprint(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnhashchange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnlanguagechange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmessage(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnmessageerror(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnoffline(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnonline(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpagehide(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpageshow(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnpopstate(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnstorage(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnunload(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndevicemotion(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndeviceorientation(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnabsolutedeviceorientation(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndeviceproximity(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnuserproximity(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOndevicelight(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnvrdisplayactivate(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnvrdisplaydeactivate(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnvrdisplayconnect(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnvrdisplaydisconnect(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnvrdisplaypresentchange(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnappinstalled(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntouchstart(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntouchend(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntouchmove(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntouchcancel(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntransitionstart(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntransitionrun(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntransitionend(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOntransitioncancel(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnanimationstart(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnanimationend(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnanimationiteration(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnanimationcancel(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwebkitAnimationEnd(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwebkitAnimationIteration(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwebkitAnimationStart(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwebkitTransitionEnd(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwebkitanimationend(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwebkitanimationiteration(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwebkitanimationstart(mozilla::dom::EventHandlerNonNull*) Unexecuted instantiation: nsGlobalWindowInner::SetOnwebkittransitionend(mozilla::dom::EventHandlerNonNull*) |
592 | | #define ERROR_EVENT(name_, id_, type_, struct_) \ |
593 | | mozilla::dom::OnErrorEventHandlerNonNull* GetOn##name_() \ |
594 | 0 | { \ |
595 | 0 | mozilla::EventListenerManager* elm = GetExistingListenerManager(); \ |
596 | 0 | return elm ? elm->GetOnErrorEventHandler() : nullptr; \ |
597 | 0 | } \ |
598 | | void SetOn##name_(mozilla::dom::OnErrorEventHandlerNonNull* handler) \ |
599 | 0 | { \ |
600 | 0 | mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \ |
601 | 0 | if (elm) { \ |
602 | 0 | elm->SetEventHandler(handler); \ |
603 | 0 | } \ |
604 | 0 | } |
605 | | #define BEFOREUNLOAD_EVENT(name_, id_, type_, struct_) \ |
606 | | mozilla::dom::OnBeforeUnloadEventHandlerNonNull* GetOn##name_() \ |
607 | 0 | { \ |
608 | 0 | mozilla::EventListenerManager* elm = GetExistingListenerManager(); \ |
609 | 0 | return elm ? elm->GetOnBeforeUnloadEventHandler() : nullptr; \ |
610 | 0 | } \ |
611 | | void SetOn##name_(mozilla::dom::OnBeforeUnloadEventHandlerNonNull* handler) \ |
612 | 0 | { \ |
613 | 0 | mozilla::EventListenerManager* elm = GetOrCreateListenerManager(); \ |
614 | 0 | if (elm) { \ |
615 | 0 | elm->SetEventHandler(handler); \ |
616 | 0 | } \ |
617 | 0 | } |
618 | | #define WINDOW_ONLY_EVENT EVENT |
619 | | #define TOUCH_EVENT EVENT |
620 | | #include "mozilla/EventNameList.h" |
621 | | #undef TOUCH_EVENT |
622 | | #undef WINDOW_ONLY_EVENT |
623 | | #undef BEFOREUNLOAD_EVENT |
624 | | #undef ERROR_EVENT |
625 | | #undef EVENT |
626 | | |
627 | | nsISupports* GetParentObject() |
628 | 0 | { |
629 | 0 | return nullptr; |
630 | 0 | } |
631 | | |
632 | | static JSObject* |
633 | | CreateNamedPropertiesObject(JSContext *aCx, JS::Handle<JSObject*> aProto); |
634 | | |
635 | | nsGlobalWindowInner* Window(); |
636 | | nsGlobalWindowInner* Self(); |
637 | | nsIDocument* GetDocument() |
638 | 0 | { |
639 | 0 | return GetDoc(); |
640 | 0 | } |
641 | | void GetName(nsAString& aName, mozilla::ErrorResult& aError); |
642 | | void SetName(const nsAString& aName, mozilla::ErrorResult& aError); |
643 | | mozilla::dom::Location* GetLocation() override; |
644 | | nsHistory* GetHistory(mozilla::ErrorResult& aError); |
645 | | mozilla::dom::CustomElementRegistry* CustomElements() override; |
646 | | mozilla::dom::BarProp* GetLocationbar(mozilla::ErrorResult& aError); |
647 | | mozilla::dom::BarProp* GetMenubar(mozilla::ErrorResult& aError); |
648 | | mozilla::dom::BarProp* GetPersonalbar(mozilla::ErrorResult& aError); |
649 | | mozilla::dom::BarProp* GetScrollbars(mozilla::ErrorResult& aError); |
650 | | mozilla::dom::BarProp* GetStatusbar(mozilla::ErrorResult& aError); |
651 | | mozilla::dom::BarProp* GetToolbar(mozilla::ErrorResult& aError); |
652 | | void GetStatus(nsAString& aStatus, mozilla::ErrorResult& aError); |
653 | | void SetStatus(const nsAString& aStatus, mozilla::ErrorResult& aError); |
654 | | void Close(mozilla::ErrorResult& aError); |
655 | | nsresult Close() override; |
656 | | bool GetClosed(mozilla::ErrorResult& aError); |
657 | | void Stop(mozilla::ErrorResult& aError); |
658 | | void Focus(mozilla::ErrorResult& aError); |
659 | | nsresult Focus() override; |
660 | | void Blur(mozilla::ErrorResult& aError); |
661 | | nsDOMWindowList* GetFrames() final; |
662 | | already_AddRefed<nsPIDOMWindowOuter> GetFrames(mozilla::ErrorResult& aError); |
663 | | uint32_t Length(); |
664 | | already_AddRefed<nsPIDOMWindowOuter> GetTop(mozilla::ErrorResult& aError); |
665 | | protected: |
666 | | explicit nsGlobalWindowInner(nsGlobalWindowOuter *aOuterWindow); |
667 | | // Initializes the mWasOffline member variable |
668 | | void InitWasOffline(); |
669 | | public: |
670 | | nsPIDOMWindowOuter* GetOpenerWindow(mozilla::ErrorResult& aError); |
671 | | void GetOpener(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval, |
672 | | mozilla::ErrorResult& aError); |
673 | | void SetOpener(JSContext* aCx, JS::Handle<JS::Value> aOpener, |
674 | | mozilla::ErrorResult& aError); |
675 | | void GetEvent(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval); |
676 | | already_AddRefed<nsPIDOMWindowOuter> GetParent(mozilla::ErrorResult& aError); |
677 | | nsPIDOMWindowOuter* GetScriptableParent() override; |
678 | | mozilla::dom::Element* |
679 | | GetFrameElement(nsIPrincipal& aSubjectPrincipal, |
680 | | mozilla::ErrorResult& aError); |
681 | | mozilla::dom::Element* GetFrameElement() override; |
682 | | already_AddRefed<nsPIDOMWindowOuter> |
683 | | Open(const nsAString& aUrl, |
684 | | const nsAString& aName, |
685 | | const nsAString& aOptions, |
686 | | mozilla::ErrorResult& aError); |
687 | | nsDOMOfflineResourceList* GetApplicationCache(mozilla::ErrorResult& aError); |
688 | | nsDOMOfflineResourceList* GetApplicationCache() override; |
689 | | |
690 | | #if defined(MOZ_WIDGET_ANDROID) |
691 | | int16_t Orientation(mozilla::dom::CallerType aCallerType) const; |
692 | | #endif |
693 | | |
694 | | already_AddRefed<mozilla::dom::Console> |
695 | | GetConsole(JSContext* aCx, mozilla::ErrorResult& aRv); |
696 | | |
697 | | // https://w3c.github.io/webappsec-secure-contexts/#dom-window-issecurecontext |
698 | | bool IsSecureContext() const; |
699 | | |
700 | | void GetSidebar(mozilla::dom::OwningExternalOrWindowProxy& aResult, |
701 | | mozilla::ErrorResult& aRv); |
702 | | already_AddRefed<mozilla::dom::External> GetExternal(mozilla::ErrorResult& aRv); |
703 | | |
704 | | mozilla::dom::Worklet* |
705 | | GetPaintWorklet(mozilla::ErrorResult& aRv); |
706 | | |
707 | | void |
708 | | GetRegionalPrefsLocales(nsTArray<nsString>& aLocales); |
709 | | |
710 | | mozilla::dom::IntlUtils* |
711 | | GetIntlUtils(mozilla::ErrorResult& aRv); |
712 | | |
713 | | public: |
714 | | void Alert(nsIPrincipal& aSubjectPrincipal, |
715 | | mozilla::ErrorResult& aError); |
716 | | void Alert(const nsAString& aMessage, |
717 | | nsIPrincipal& aSubjectPrincipal, |
718 | | mozilla::ErrorResult& aError); |
719 | | bool Confirm(const nsAString& aMessage, |
720 | | nsIPrincipal& aSubjectPrincipal, |
721 | | mozilla::ErrorResult& aError); |
722 | | void Prompt(const nsAString& aMessage, const nsAString& aInitial, |
723 | | nsAString& aReturn, |
724 | | nsIPrincipal& aSubjectPrincipal, |
725 | | mozilla::ErrorResult& aError); |
726 | | already_AddRefed<mozilla::dom::cache::CacheStorage> GetCaches(mozilla::ErrorResult& aRv); |
727 | | already_AddRefed<mozilla::dom::Promise> Fetch(const mozilla::dom::RequestOrUSVString& aInput, |
728 | | const mozilla::dom::RequestInit& aInit, |
729 | | mozilla::dom::CallerType aCallerType, |
730 | | mozilla::ErrorResult& aRv); |
731 | | void Print(mozilla::ErrorResult& aError); |
732 | | void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage, |
733 | | const nsAString& aTargetOrigin, |
734 | | const mozilla::dom::Sequence<JSObject*>& aTransfer, |
735 | | nsIPrincipal& aSubjectPrincipal, |
736 | | mozilla::ErrorResult& aError); |
737 | | int32_t SetTimeout(JSContext* aCx, mozilla::dom::Function& aFunction, |
738 | | int32_t aTimeout, |
739 | | const mozilla::dom::Sequence<JS::Value>& aArguments, |
740 | | mozilla::ErrorResult& aError); |
741 | | int32_t SetTimeout(JSContext* aCx, const nsAString& aHandler, |
742 | | int32_t aTimeout, |
743 | | const mozilla::dom::Sequence<JS::Value>& /* unused */, |
744 | | mozilla::ErrorResult& aError); |
745 | | void ClearTimeout(int32_t aHandle); |
746 | | int32_t SetInterval(JSContext* aCx, mozilla::dom::Function& aFunction, |
747 | | const int32_t aTimeout, |
748 | | const mozilla::dom::Sequence<JS::Value>& aArguments, |
749 | | mozilla::ErrorResult& aError); |
750 | | int32_t SetInterval(JSContext* aCx, const nsAString& aHandler, |
751 | | const int32_t aTimeout, |
752 | | const mozilla::dom::Sequence<JS::Value>& /* unused */, |
753 | | mozilla::ErrorResult& aError); |
754 | | void ClearInterval(int32_t aHandle); |
755 | | void GetOrigin(nsAString& aOrigin); |
756 | | void Atob(const nsAString& aAsciiBase64String, nsAString& aBinaryData, |
757 | | mozilla::ErrorResult& aError); |
758 | | void Btoa(const nsAString& aBinaryData, nsAString& aAsciiBase64String, |
759 | | mozilla::ErrorResult& aError); |
760 | | mozilla::dom::Storage* GetSessionStorage(mozilla::ErrorResult& aError); |
761 | | mozilla::dom::Storage* |
762 | | GetLocalStorage(mozilla::ErrorResult& aError); |
763 | | mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aError); |
764 | | mozilla::dom::IDBFactory* GetIndexedDB(mozilla::ErrorResult& aError); |
765 | | already_AddRefed<nsICSSDeclaration> |
766 | | GetComputedStyle(mozilla::dom::Element& aElt, const nsAString& aPseudoElt, |
767 | | mozilla::ErrorResult& aError) override; |
768 | | mozilla::dom::VisualViewport* VisualViewport(); |
769 | | already_AddRefed<mozilla::dom::MediaQueryList> MatchMedia( |
770 | | const nsAString& aQuery, |
771 | | mozilla::dom::CallerType aCallerType, |
772 | | mozilla::ErrorResult& aError); |
773 | | nsScreen* GetScreen(mozilla::ErrorResult& aError); |
774 | | void MoveTo(int32_t aXPos, int32_t aYPos, |
775 | | mozilla::dom::CallerType aCallerType, |
776 | | mozilla::ErrorResult& aError); |
777 | | void MoveBy(int32_t aXDif, int32_t aYDif, |
778 | | mozilla::dom::CallerType aCallerType, |
779 | | mozilla::ErrorResult& aError); |
780 | | void ResizeTo(int32_t aWidth, int32_t aHeight, |
781 | | mozilla::dom::CallerType aCallerType, |
782 | | mozilla::ErrorResult& aError); |
783 | | void ResizeBy(int32_t aWidthDif, int32_t aHeightDif, |
784 | | mozilla::dom::CallerType aCallerType, |
785 | | mozilla::ErrorResult& aError); |
786 | | void Scroll(double aXScroll, double aYScroll); |
787 | | void Scroll(const mozilla::dom::ScrollToOptions& aOptions); |
788 | | void ScrollTo(double aXScroll, double aYScroll); |
789 | | void ScrollTo(const mozilla::dom::ScrollToOptions& aOptions); |
790 | | void ScrollBy(double aXScrollDif, double aYScrollDif); |
791 | | void ScrollBy(const mozilla::dom::ScrollToOptions& aOptions); |
792 | | void ScrollByLines(int32_t numLines, |
793 | | const mozilla::dom::ScrollOptions& aOptions); |
794 | | void ScrollByPages(int32_t numPages, |
795 | | const mozilla::dom::ScrollOptions& aOptions); |
796 | | void MozScrollSnap(); |
797 | | void GetInnerWidth(JSContext* aCx, JS::MutableHandle<JS::Value> aValue, |
798 | | mozilla::dom::CallerType aCallerType, |
799 | | mozilla::ErrorResult& aError); |
800 | | void SetInnerWidth(JSContext* aCx, JS::Handle<JS::Value> aValue, |
801 | | mozilla::dom::CallerType aCallerType, |
802 | | mozilla::ErrorResult& aError); |
803 | | void GetInnerHeight(JSContext* aCx, JS::MutableHandle<JS::Value> aValue, |
804 | | mozilla::dom::CallerType aCallerType, |
805 | | mozilla::ErrorResult& aError); |
806 | | void SetInnerHeight(JSContext* aCx, JS::Handle<JS::Value> aValue, |
807 | | mozilla::dom::CallerType aCallerType, |
808 | | mozilla::ErrorResult& aError); |
809 | | double GetScrollX(mozilla::ErrorResult& aError); |
810 | | double GetPageXOffset(mozilla::ErrorResult& aError) |
811 | 0 | { |
812 | 0 | return GetScrollX(aError); |
813 | 0 | } |
814 | | double GetScrollY(mozilla::ErrorResult& aError); |
815 | | double GetPageYOffset(mozilla::ErrorResult& aError) |
816 | 0 | { |
817 | 0 | return GetScrollY(aError); |
818 | 0 | } |
819 | | void GetScreenX(JSContext* aCx, JS::MutableHandle<JS::Value> aValue, |
820 | | mozilla::dom::CallerType aCallerType, |
821 | | mozilla::ErrorResult& aError); |
822 | | void SetScreenX(JSContext* aCx, JS::Handle<JS::Value> aValue, |
823 | | mozilla::dom::CallerType aCallerType, |
824 | | mozilla::ErrorResult& aError); |
825 | | void GetScreenY(JSContext* aCx, JS::MutableHandle<JS::Value> aValue, |
826 | | mozilla::dom::CallerType aCallerType, |
827 | | mozilla::ErrorResult& aError); |
828 | | void SetScreenY(JSContext* aCx, JS::Handle<JS::Value> aValue, |
829 | | mozilla::dom::CallerType aCallerType, |
830 | | mozilla::ErrorResult& aError); |
831 | | void GetOuterWidth(JSContext* aCx, JS::MutableHandle<JS::Value> aValue, |
832 | | mozilla::dom::CallerType aCallerType, |
833 | | mozilla::ErrorResult& aError); |
834 | | void SetOuterWidth(JSContext* aCx, JS::Handle<JS::Value> aValue, |
835 | | mozilla::dom::CallerType aCallerType, |
836 | | mozilla::ErrorResult& aError); |
837 | | void GetOuterHeight(JSContext* aCx, JS::MutableHandle<JS::Value> aValue, |
838 | | mozilla::dom::CallerType aCallerType, |
839 | | mozilla::ErrorResult& aError); |
840 | | void SetOuterHeight(JSContext* aCx, JS::Handle<JS::Value> aValue, |
841 | | mozilla::dom::CallerType aCallerType, |
842 | | mozilla::ErrorResult& aError); |
843 | | int32_t RequestAnimationFrame(mozilla::dom::FrameRequestCallback& aCallback, |
844 | | mozilla::ErrorResult& aError); |
845 | | void CancelAnimationFrame(int32_t aHandle, mozilla::ErrorResult& aError); |
846 | | |
847 | | uint32_t RequestIdleCallback(JSContext* aCx, |
848 | | mozilla::dom::IdleRequestCallback& aCallback, |
849 | | const mozilla::dom::IdleRequestOptions& aOptions, |
850 | | mozilla::ErrorResult& aError); |
851 | | void CancelIdleCallback(uint32_t aHandle); |
852 | | |
853 | | #ifdef MOZ_WEBSPEECH |
854 | | mozilla::dom::SpeechSynthesis* |
855 | | GetSpeechSynthesis(mozilla::ErrorResult& aError); |
856 | | bool HasActiveSpeechSynthesis(); |
857 | | #endif |
858 | | already_AddRefed<nsICSSDeclaration> |
859 | | GetDefaultComputedStyle(mozilla::dom::Element& aElt, |
860 | | const nsAString& aPseudoElt, |
861 | | mozilla::ErrorResult& aError); |
862 | | void SizeToContent(mozilla::dom::CallerType aCallerType, |
863 | | mozilla::ErrorResult& aError); |
864 | | mozilla::dom::Crypto* GetCrypto(mozilla::ErrorResult& aError); |
865 | | mozilla::dom::U2F* GetU2f(mozilla::ErrorResult& aError); |
866 | | nsIControllers* GetControllers(mozilla::ErrorResult& aError); |
867 | | nsresult GetControllers(nsIControllers** aControllers) override; |
868 | | mozilla::dom::Element* GetRealFrameElement(mozilla::ErrorResult& aError); |
869 | | float GetMozInnerScreenX(mozilla::dom::CallerType aCallerType, |
870 | | mozilla::ErrorResult& aError); |
871 | | float GetMozInnerScreenY(mozilla::dom::CallerType aCallerType, |
872 | | mozilla::ErrorResult& aError); |
873 | | double GetDevicePixelRatio(mozilla::dom::CallerType aCallerType, |
874 | | mozilla::ErrorResult& aError); |
875 | | int32_t GetScrollMinX(mozilla::ErrorResult& aError); |
876 | | int32_t GetScrollMinY(mozilla::ErrorResult& aError); |
877 | | int32_t GetScrollMaxX(mozilla::ErrorResult& aError); |
878 | | int32_t GetScrollMaxY(mozilla::ErrorResult& aError); |
879 | | bool GetFullScreen(mozilla::ErrorResult& aError); |
880 | | bool GetFullScreen() override; |
881 | | void SetFullScreen(bool aFullscreen, mozilla::ErrorResult& aError); |
882 | | bool Find(const nsAString& aString, bool aCaseSensitive, bool aBackwards, |
883 | | bool aWrapAround, bool aWholeWord, bool aSearchInFrames, |
884 | | bool aShowDialog, mozilla::ErrorResult& aError); |
885 | | uint64_t GetMozPaintCount(mozilla::ErrorResult& aError); |
886 | | |
887 | | bool ShouldResistFingerprinting(); |
888 | | |
889 | | already_AddRefed<nsPIDOMWindowOuter> |
890 | | OpenDialog(JSContext* aCx, |
891 | | const nsAString& aUrl, |
892 | | const nsAString& aName, |
893 | | const nsAString& aOptions, |
894 | | const mozilla::dom::Sequence<JS::Value>& aExtraArgument, |
895 | | mozilla::ErrorResult& aError); |
896 | | void UpdateCommands(const nsAString& anAction, mozilla::dom::Selection* aSel, |
897 | | int16_t aReason); |
898 | | |
899 | | void GetContent(JSContext* aCx, |
900 | | JS::MutableHandle<JSObject*> aRetval, |
901 | | mozilla::dom::CallerType aCallerType, |
902 | | mozilla::ErrorResult& aError); |
903 | | |
904 | | already_AddRefed<mozilla::dom::Promise> |
905 | | CreateImageBitmap(JSContext* aCx, |
906 | | const mozilla::dom::ImageBitmapSource& aImage, |
907 | | mozilla::ErrorResult& aRv); |
908 | | |
909 | | already_AddRefed<mozilla::dom::Promise> |
910 | | CreateImageBitmap(JSContext* aCx, |
911 | | const mozilla::dom::ImageBitmapSource& aImage, |
912 | | int32_t aSx, int32_t aSy, int32_t aSw, int32_t aSh, |
913 | | mozilla::ErrorResult& aRv); |
914 | | |
915 | | already_AddRefed<mozilla::dom::Promise> |
916 | | CreateImageBitmap(JSContext* aCx, |
917 | | const mozilla::dom::ImageBitmapSource& aImage, |
918 | | int32_t aOffset, int32_t aLength, |
919 | | mozilla::dom::ImageBitmapFormat aFormat, |
920 | | const mozilla::dom::Sequence<mozilla::dom::ChannelPixelLayout>& aLayout, |
921 | | mozilla::ErrorResult& aRv); |
922 | | |
923 | | |
924 | | // ChromeWindow bits. Do NOT call these unless your window is in |
925 | | // fact chrome. |
926 | | uint16_t WindowState(); |
927 | | bool IsFullyOccluded(); |
928 | | nsIBrowserDOMWindow* GetBrowserDOMWindow(mozilla::ErrorResult& aError); |
929 | | void SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserWindow, |
930 | | mozilla::ErrorResult& aError); |
931 | | void GetAttention(mozilla::ErrorResult& aError); |
932 | | void GetAttentionWithCycleCount(int32_t aCycleCount, |
933 | | mozilla::ErrorResult& aError); |
934 | | void SetCursor(const nsAString& aCursor, mozilla::ErrorResult& aError); |
935 | | void Maximize(); |
936 | | void Minimize(); |
937 | | void Restore(); |
938 | | void NotifyDefaultButtonLoaded(mozilla::dom::Element& aDefaultButton, |
939 | | mozilla::ErrorResult& aError); |
940 | | mozilla::dom::ChromeMessageBroadcaster* MessageManager(); |
941 | | mozilla::dom::ChromeMessageBroadcaster* GetGroupMessageManager(const nsAString& aGroup); |
942 | | void BeginWindowMove(mozilla::dom::Event& aMouseDownEvent, |
943 | | mozilla::ErrorResult& aError); |
944 | | |
945 | | already_AddRefed<mozilla::dom::Promise> |
946 | | PromiseDocumentFlushed(mozilla::dom::PromiseDocumentFlushedCallback& aCallback, |
947 | | mozilla::ErrorResult& aError); |
948 | | |
949 | | void DidRefresh() override; |
950 | | |
951 | | void GetDialogArgumentsOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval, |
952 | | nsIPrincipal& aSubjectPrincipal, |
953 | | mozilla::ErrorResult& aError); |
954 | | void GetDialogArguments(JSContext* aCx, JS::MutableHandle<JS::Value> aRetval, |
955 | | nsIPrincipal& aSubjectPrincipal, |
956 | | mozilla::ErrorResult& aError); |
957 | | void GetReturnValueOuter(JSContext* aCx, JS::MutableHandle<JS::Value> aReturnValue, |
958 | | nsIPrincipal& aSubjectPrincipal, |
959 | | mozilla::ErrorResult& aError); |
960 | | void GetReturnValue(JSContext* aCx, JS::MutableHandle<JS::Value> aReturnValue, |
961 | | nsIPrincipal& aSubjectPrincipal, |
962 | | mozilla::ErrorResult& aError); |
963 | | void SetReturnValueOuter(JSContext* aCx, JS::Handle<JS::Value> aReturnValue, |
964 | | nsIPrincipal& aSubjectPrincipal, |
965 | | mozilla::ErrorResult& aError); |
966 | | void SetReturnValue(JSContext* aCx, JS::Handle<JS::Value> aReturnValue, |
967 | | nsIPrincipal& aSubjectPrincipal, |
968 | | mozilla::ErrorResult& aError); |
969 | | |
970 | | void GetInterface(JSContext* aCx, nsIJSID* aIID, |
971 | | JS::MutableHandle<JS::Value> aRetval, |
972 | | mozilla::ErrorResult& aError); |
973 | | |
974 | | already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError); |
975 | | |
976 | | bool ShouldReportForServiceWorkerScope(const nsAString& aScope); |
977 | | |
978 | | void PropagateClearSiteDataReload(const nsACString& aOrigin); |
979 | | |
980 | | already_AddRefed<mozilla::dom::InstallTriggerImpl> GetInstallTrigger(); |
981 | | |
982 | | nsIDOMWindowUtils* GetWindowUtils(mozilla::ErrorResult& aRv); |
983 | | |
984 | | void UpdateTopInnerWindow(); |
985 | | |
986 | | virtual bool IsInSyncOperation() override |
987 | 0 | { |
988 | 0 | return GetExtantDoc() && GetExtantDoc()->IsInSyncOperation(); |
989 | 0 | } |
990 | | |
991 | | protected: |
992 | | // Web IDL helpers |
993 | | |
994 | | // Redefine the property called aPropName on this window object to be a value |
995 | | // property with the value aValue, much like we would do for a [Replaceable] |
996 | | // property in IDL. |
997 | | void RedefineProperty(JSContext* aCx, const char* aPropName, |
998 | | JS::Handle<JS::Value> aValue, |
999 | | mozilla::ErrorResult& aError); |
1000 | | |
1001 | | // Implementation guts for our writable IDL attributes that are really |
1002 | | // supposed to be readonly replaceable. |
1003 | | typedef int32_t |
1004 | | (nsGlobalWindowInner::*WindowCoordGetter)(mozilla::dom::CallerType aCallerType, |
1005 | | mozilla::ErrorResult&); |
1006 | | typedef void |
1007 | | (nsGlobalWindowInner::*WindowCoordSetter)(int32_t, |
1008 | | mozilla::dom::CallerType aCallerType, |
1009 | | mozilla::ErrorResult&); |
1010 | | void GetReplaceableWindowCoord(JSContext* aCx, WindowCoordGetter aGetter, |
1011 | | JS::MutableHandle<JS::Value> aRetval, |
1012 | | mozilla::dom::CallerType aCallerType, |
1013 | | mozilla::ErrorResult& aError); |
1014 | | void SetReplaceableWindowCoord(JSContext* aCx, WindowCoordSetter aSetter, |
1015 | | JS::Handle<JS::Value> aValue, |
1016 | | const char* aPropName, |
1017 | | mozilla::dom::CallerType aCallerType, |
1018 | | mozilla::ErrorResult& aError); |
1019 | | // And the implementations of WindowCoordGetter/WindowCoordSetter. |
1020 | | protected: |
1021 | | int32_t GetInnerWidth(mozilla::dom::CallerType aCallerType, |
1022 | | mozilla::ErrorResult& aError); |
1023 | | nsresult GetInnerWidth(int32_t* aWidth) override; |
1024 | | void SetInnerWidth(int32_t aInnerWidth, |
1025 | | mozilla::dom::CallerType aCallerType, |
1026 | | mozilla::ErrorResult& aError); |
1027 | | protected: |
1028 | | int32_t GetInnerHeight(mozilla::dom::CallerType aCallerType, |
1029 | | mozilla::ErrorResult& aError); |
1030 | | nsresult GetInnerHeight(int32_t* aHeight) override; |
1031 | | void SetInnerHeight(int32_t aInnerHeight, |
1032 | | mozilla::dom::CallerType aCallerType, |
1033 | | mozilla::ErrorResult& aError); |
1034 | | int32_t GetScreenX(mozilla::dom::CallerType aCallerType, |
1035 | | mozilla::ErrorResult& aError); |
1036 | | void SetScreenX(int32_t aScreenX, |
1037 | | mozilla::dom::CallerType aCallerType, |
1038 | | mozilla::ErrorResult& aError); |
1039 | | int32_t GetScreenY(mozilla::dom::CallerType aCallerType, |
1040 | | mozilla::ErrorResult& aError); |
1041 | | void SetScreenY(int32_t aScreenY, |
1042 | | mozilla::dom::CallerType aCallerType, |
1043 | | mozilla::ErrorResult& aError); |
1044 | | int32_t GetOuterWidth(mozilla::dom::CallerType aCallerType, |
1045 | | mozilla::ErrorResult& aError); |
1046 | | void SetOuterWidth(int32_t aOuterWidth, |
1047 | | mozilla::dom::CallerType aCallerType, |
1048 | | mozilla::ErrorResult& aError); |
1049 | | int32_t GetOuterHeight(mozilla::dom::CallerType aCallerType, |
1050 | | mozilla::ErrorResult& aError); |
1051 | | void SetOuterHeight(int32_t aOuterHeight, |
1052 | | mozilla::dom::CallerType aCallerType, |
1053 | | mozilla::ErrorResult& aError); |
1054 | | |
1055 | | // Array of idle observers that are notified of idle events. |
1056 | | nsTObserverArray<IdleObserverHolder> mIdleObservers; |
1057 | | |
1058 | | // Idle timer used for function callbacks to notify idle observers. |
1059 | | nsCOMPtr<nsITimer> mIdleTimer; |
1060 | | |
1061 | | // Idle fuzz time added to idle timer callbacks. |
1062 | | uint32_t mIdleFuzzFactor; |
1063 | | |
1064 | | // Index in mArrayIdleObservers |
1065 | | // Next idle observer to notify user idle status |
1066 | | int32_t mIdleCallbackIndex; |
1067 | | |
1068 | | // If false then the topic is "active" |
1069 | | // If true then the topic is "idle" |
1070 | | bool mCurrentlyIdle; |
1071 | | |
1072 | | // Set to true when a fuzz time needs to be applied |
1073 | | // to active notifications to the idle observer. |
1074 | | bool mAddActiveEventFuzzTime; |
1075 | | |
1076 | | nsCOMPtr <nsIIdleService> mIdleService; |
1077 | | |
1078 | | RefPtr<mozilla::dom::WakeLock> mWakeLock; |
1079 | | |
1080 | | friend class HashchangeCallback; |
1081 | | friend class mozilla::dom::BarProp; |
1082 | | |
1083 | | // Object Management |
1084 | | virtual ~nsGlobalWindowInner(); |
1085 | | |
1086 | | void FreeInnerObjects(); |
1087 | | |
1088 | | // Only to be called on an inner window. |
1089 | | // aDocument must not be null. |
1090 | | void InnerSetNewDocument(JSContext* aCx, nsIDocument* aDocument); |
1091 | | |
1092 | | nsresult EnsureClientSource(); |
1093 | | nsresult ExecutionReady(); |
1094 | | |
1095 | | // Inner windows only. |
1096 | | nsresult DefineArgumentsProperty(nsIArray *aArguments); |
1097 | | |
1098 | | // Get the parent, returns null if this is a toplevel window |
1099 | | nsPIDOMWindowOuter* GetParentInternal(); |
1100 | | |
1101 | | public: |
1102 | | // popup tracking |
1103 | | bool IsPopupSpamWindow(); |
1104 | | |
1105 | | private: |
1106 | | // A type that methods called by CallOnChildren can return. If Stop |
1107 | | // is returned then CallOnChildren will stop calling further children. |
1108 | | // If Continue is returned then CallOnChildren will keep calling further |
1109 | | // children. |
1110 | | enum class CallState |
1111 | | { |
1112 | | Continue, |
1113 | | Stop, |
1114 | | }; |
1115 | | |
1116 | | // Call the given method on the immediate children of this window. The |
1117 | | // CallState returned by the last child method invocation is returned or |
1118 | | // CallState::Continue if the method returns void. |
1119 | | template<typename Method, typename... Args> |
1120 | | CallState CallOnChildren(Method aMethod, Args& ...aArgs); |
1121 | | |
1122 | | // Helper to convert a void returning child method into an implicit |
1123 | | // CallState::Continue value. |
1124 | | template<typename Return, typename Method, typename... Args> |
1125 | | typename std::enable_if<std::is_void<Return>::value, |
1126 | | nsGlobalWindowInner::CallState>::type |
1127 | | CallChild(nsGlobalWindowInner* aWindow, Method aMethod, Args& ...aArgs) |
1128 | 0 | { |
1129 | 0 | (aWindow->*aMethod)(aArgs...); |
1130 | 0 | return nsGlobalWindowInner::CallState::Continue; |
1131 | 0 | } Unexecuted instantiation: _ZN19nsGlobalWindowInner9CallChildIvMS_FvvEJEEENSt3__19enable_ifIXsr3std7is_voidIT_EE5valueENS_9CallStateEE4typeEPS_T0_DpRT1_ Unexecuted instantiation: _ZN19nsGlobalWindowInner9CallChildIvMS_FvRK12nsTSubstringIcEEJS3_EEENSt3__19enable_ifIXsr3std7is_voidIT_EE5valueENS_9CallStateEE4typeEPS_T0_DpRT1_ |
1132 | | |
1133 | | // Helper that passes through the CallState value from a child method. |
1134 | | template<typename Return, typename Method, typename... Args> |
1135 | | typename std::enable_if<std::is_same<Return, |
1136 | | nsGlobalWindowInner::CallState>::value, |
1137 | | nsGlobalWindowInner::CallState>::type |
1138 | | CallChild(nsGlobalWindowInner* aWindow, Method aMethod, Args& ...aArgs) |
1139 | 0 | { |
1140 | 0 | return (aWindow->*aMethod)(aArgs...); |
1141 | 0 | } |
1142 | | |
1143 | | void FreezeInternal(); |
1144 | | void ThawInternal(); |
1145 | | |
1146 | | CallState ShouldReportForServiceWorkerScopeInternal(const nsACString& aScope, |
1147 | | bool* aResultOut); |
1148 | | |
1149 | | void |
1150 | | MigrateStateForDocumentOpen(nsGlobalWindowInner* aOldInner); |
1151 | | |
1152 | | public: |
1153 | | // Timeout Functions |
1154 | | // |interval| is in milliseconds. |
1155 | | int32_t SetTimeoutOrInterval(JSContext* aCx, |
1156 | | mozilla::dom::Function& aFunction, |
1157 | | int32_t aTimeout, |
1158 | | const mozilla::dom::Sequence<JS::Value>& aArguments, |
1159 | | bool aIsInterval, mozilla::ErrorResult& aError); |
1160 | | int32_t SetTimeoutOrInterval(JSContext* aCx, const nsAString& aHandler, |
1161 | | int32_t aTimeout, bool aIsInterval, |
1162 | | mozilla::ErrorResult& aError); |
1163 | | |
1164 | | // Return true if |aTimeout| was cleared while its handler ran. |
1165 | | bool RunTimeoutHandler(mozilla::dom::Timeout* aTimeout, nsIScriptContext* aScx); |
1166 | | |
1167 | | // Helper Functions |
1168 | | already_AddRefed<nsIDocShellTreeOwner> GetTreeOwner(); |
1169 | | already_AddRefed<nsIWebBrowserChrome> GetWebBrowserChrome(); |
1170 | | bool IsPrivateBrowsing(); |
1171 | | |
1172 | | void FireOfflineStatusEventIfChanged(); |
1173 | | |
1174 | | public: |
1175 | | // Inner windows only. |
1176 | | nsresult ScheduleNextIdleObserverCallback(); |
1177 | | uint32_t GetFuzzTimeMS(); |
1178 | | nsresult ScheduleActiveTimerCallback(); |
1179 | | uint32_t FindInsertionIndex(IdleObserverHolder* aIdleObserver); |
1180 | | nsresult RegisterIdleObserver( |
1181 | | mozilla::dom::MozIdleObserver& aIdleObserverPtr) override; |
1182 | | nsresult FindIndexOfElementToRemove( |
1183 | | mozilla::dom::MozIdleObserver& aIdleObserver, |
1184 | | int32_t* aRemoveElementIndex); |
1185 | | nsresult UnregisterIdleObserver( |
1186 | | mozilla::dom::MozIdleObserver& aIdleObserverPtr) override; |
1187 | | |
1188 | | // Inner windows only. |
1189 | | nsresult FireHashchange(const nsAString &aOldURL, const nsAString &aNewURL); |
1190 | | |
1191 | | void FlushPendingNotifications(mozilla::FlushType aType); |
1192 | | |
1193 | | void ScrollTo(const mozilla::CSSIntPoint& aScroll, |
1194 | | const mozilla::dom::ScrollOptions& aOptions); |
1195 | | |
1196 | | bool IsFrame(); |
1197 | | |
1198 | | already_AddRefed<nsIWidget> GetMainWidget(); |
1199 | | nsIWidget* GetNearestWidget() const; |
1200 | | |
1201 | | bool IsInModalState(); |
1202 | | |
1203 | | virtual void SetFocusedElement(mozilla::dom::Element* aElement, |
1204 | | uint32_t aFocusMethod = 0, |
1205 | | bool aNeedsFocus = false) override; |
1206 | | |
1207 | | virtual uint32_t GetFocusMethod() override; |
1208 | | |
1209 | | virtual bool ShouldShowFocusRing() override; |
1210 | | |
1211 | | // Inner windows only. |
1212 | | void UpdateCanvasFocus(bool aFocusChanged, nsIContent* aNewContent); |
1213 | | |
1214 | | public: |
1215 | | virtual already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() override; |
1216 | | |
1217 | | // Get the toplevel principal, returns null if this is a toplevel window. |
1218 | | nsIPrincipal* GetTopLevelPrincipal(); |
1219 | | |
1220 | | // Get the parent principal, returns null if this or the parent are not a |
1221 | | // toplevel window. This is mainly used to determine the anti-tracking storage |
1222 | | // area. |
1223 | | nsIPrincipal* GetTopLevelStorageAreaPrincipal(); |
1224 | | |
1225 | | protected: |
1226 | | static void NotifyDOMWindowDestroyed(nsGlobalWindowInner* aWindow); |
1227 | | void NotifyWindowIDDestroyed(const char* aTopic); |
1228 | | |
1229 | | static void NotifyDOMWindowFrozen(nsGlobalWindowInner* aWindow); |
1230 | | static void NotifyDOMWindowThawed(nsGlobalWindowInner* aWindow); |
1231 | | |
1232 | | virtual void UpdateParentTarget() override; |
1233 | | |
1234 | | void InitializeShowFocusRings(); |
1235 | | |
1236 | | // Clear the document-dependent slots on our JS wrapper. Inner windows only. |
1237 | | void ClearDocumentDependentSlots(JSContext* aCx); |
1238 | | |
1239 | | // Inner windows only. |
1240 | | already_AddRefed<mozilla::dom::StorageEvent> |
1241 | | CloneStorageEvent(const nsAString& aType, |
1242 | | const RefPtr<mozilla::dom::StorageEvent>& aEvent, |
1243 | | mozilla::ErrorResult& aRv); |
1244 | | |
1245 | | protected: |
1246 | | already_AddRefed<nsICSSDeclaration> |
1247 | | GetComputedStyleHelper(mozilla::dom::Element& aElt, |
1248 | | const nsAString& aPseudoElt, |
1249 | | bool aDefaultStylesOnly, |
1250 | | mozilla::ErrorResult& aError); |
1251 | | |
1252 | | nsGlobalWindowInner* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError); |
1253 | | |
1254 | | void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage, |
1255 | | const nsAString& aTargetOrigin, |
1256 | | JS::Handle<JS::Value> aTransfer, |
1257 | | nsIPrincipal& aSubjectPrincipal, |
1258 | | mozilla::ErrorResult& aError); |
1259 | | |
1260 | | private: |
1261 | | // Fire the JS engine's onNewGlobalObject hook. Only used on inner windows. |
1262 | | void FireOnNewGlobalObject(); |
1263 | | |
1264 | | // Helper for resolving the components shim. |
1265 | | bool ResolveComponentsShim(JSContext* aCx, JS::Handle<JSObject*> aObj, |
1266 | | JS::MutableHandle<JS::PropertyDescriptor> aDesc); |
1267 | | |
1268 | | // nsPIDOMWindow{Inner,Outer} should be able to see these helper methods. |
1269 | | friend class nsPIDOMWindowInner; |
1270 | | friend class nsPIDOMWindowOuter; |
1271 | | |
1272 | | mozilla::dom::TabGroup* TabGroupInner(); |
1273 | | |
1274 | | bool IsBackgroundInternal() const; |
1275 | | |
1276 | | // NOTE: Chrome Only |
1277 | | void DisconnectAndClearGroupMessageManagers() |
1278 | 0 | { |
1279 | 0 | MOZ_RELEASE_ASSERT(IsChromeWindow()); |
1280 | 0 | for (auto iter = mChromeFields.mGroupMessageManagers.Iter(); !iter.Done(); iter.Next()) { |
1281 | 0 | mozilla::dom::ChromeMessageBroadcaster* mm = iter.UserData(); |
1282 | 0 | if (mm) { |
1283 | 0 | mm->Disconnect(); |
1284 | 0 | } |
1285 | 0 | } |
1286 | 0 | mChromeFields.mGroupMessageManagers.Clear(); |
1287 | 0 | } |
1288 | | |
1289 | | // Call or Cancel mDocumentFlushedResolvers items, and perform MicroTask |
1290 | | // checkpoint after that, and adds observer if new mDocumentFlushedResolvers |
1291 | | // items are added while Promise callbacks inside the checkpoint. |
1292 | | template<bool call> |
1293 | | void CallOrCancelDocumentFlushedResolvers(); |
1294 | | |
1295 | | void CallDocumentFlushedResolvers(); |
1296 | | void CancelDocumentFlushedResolvers(); |
1297 | | |
1298 | | public: |
1299 | | // Dispatch a runnable related to the global. |
1300 | | virtual nsresult Dispatch(mozilla::TaskCategory aCategory, |
1301 | | already_AddRefed<nsIRunnable>&& aRunnable) override; |
1302 | | |
1303 | | virtual nsISerialEventTarget* |
1304 | | EventTargetFor(mozilla::TaskCategory aCategory) const override; |
1305 | | |
1306 | | virtual mozilla::AbstractThread* |
1307 | | AbstractMainThreadFor(mozilla::TaskCategory aCategory) override; |
1308 | | |
1309 | | void DisableIdleCallbackRequests(); |
1310 | 0 | uint32_t LastIdleRequestHandle() const { return mIdleRequestCallbackCounter - 1; } |
1311 | | nsresult RunIdleRequest(mozilla::dom::IdleRequest* aRequest, |
1312 | | DOMHighResTimeStamp aDeadline, bool aDidTimeout); |
1313 | | nsresult ExecuteIdleRequest(TimeStamp aDeadline); |
1314 | | void ScheduleIdleRequestDispatch(); |
1315 | | void SuspendIdleRequests(); |
1316 | | void ResumeIdleRequests(); |
1317 | | |
1318 | | typedef mozilla::LinkedList<RefPtr<mozilla::dom::IdleRequest>> IdleRequests; |
1319 | | void RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest); |
1320 | | |
1321 | | protected: |
1322 | | |
1323 | | // Window offline status. Checked to see if we need to fire offline event |
1324 | | bool mWasOffline : 1; |
1325 | | |
1326 | | // Represents whether the inner window's page has had a slow script notice. |
1327 | | // Only used by inner windows; will always be false for outer windows. |
1328 | | // This is used to implement Telemetry measures such as SLOW_SCRIPT_PAGE_COUNT. |
1329 | | bool mHasHadSlowScript : 1; |
1330 | | |
1331 | | // Track what sorts of events we need to fire when thawed |
1332 | | bool mNotifyIdleObserversIdleOnThaw : 1; |
1333 | | bool mNotifyIdleObserversActiveOnThaw : 1; |
1334 | | |
1335 | | // Fast way to tell if this is a chrome window (without having to QI). |
1336 | | bool mIsChrome : 1; |
1337 | | |
1338 | | // Hack to indicate whether a chrome window needs its message manager |
1339 | | // to be disconnected, since clean up code is shared in the global |
1340 | | // window superclass. |
1341 | | bool mCleanMessageManager : 1; |
1342 | | |
1343 | | // Indicates that the current document has never received a document focus |
1344 | | // event. |
1345 | | bool mNeedsFocus : 1; |
1346 | | bool mHasFocus : 1; |
1347 | | |
1348 | | // when true, show focus rings for the current focused content only. |
1349 | | // This will be reset when another element is focused |
1350 | | bool mShowFocusRingForContent : 1; |
1351 | | |
1352 | | // true if tab navigation has occurred for this window. Focus rings |
1353 | | // should be displayed. |
1354 | | bool mFocusByKeyOccurred : 1; |
1355 | | |
1356 | | // Indicates whether this window wants gamepad input events |
1357 | | bool mHasGamepad : 1; |
1358 | | |
1359 | | // Indicates whether this window wants VR events |
1360 | | bool mHasVREvents : 1; |
1361 | | |
1362 | | // Indicates whether this window wants VRDisplayActivate events |
1363 | | bool mHasVRDisplayActivateEvents : 1; |
1364 | | nsCheapSet<nsUint32HashKey> mGamepadIndexSet; |
1365 | | nsRefPtrHashtable<nsUint32HashKey, mozilla::dom::Gamepad> mGamepads; |
1366 | | bool mHasSeenGamepadInput; |
1367 | | |
1368 | | RefPtr<nsScreen> mScreen; |
1369 | | |
1370 | | RefPtr<mozilla::dom::BarProp> mMenubar; |
1371 | | RefPtr<mozilla::dom::BarProp> mToolbar; |
1372 | | RefPtr<mozilla::dom::BarProp> mLocationbar; |
1373 | | RefPtr<mozilla::dom::BarProp> mPersonalbar; |
1374 | | RefPtr<mozilla::dom::BarProp> mStatusbar; |
1375 | | RefPtr<mozilla::dom::BarProp> mScrollbars; |
1376 | | |
1377 | | RefPtr<nsGlobalWindowObserver> mObserver; |
1378 | | RefPtr<mozilla::dom::Crypto> mCrypto; |
1379 | | RefPtr<mozilla::dom::U2F> mU2F; |
1380 | | RefPtr<mozilla::dom::cache::CacheStorage> mCacheStorage; |
1381 | | RefPtr<mozilla::dom::Console> mConsole; |
1382 | | RefPtr<mozilla::dom::Worklet> mPaintWorklet; |
1383 | | // We need to store an nsISupports pointer to this object because the |
1384 | | // mozilla::dom::External class doesn't exist on b2g and using the type |
1385 | | // forward declared here means that ~nsGlobalWindow wouldn't compile because |
1386 | | // it wouldn't see the ~External function's declaration. |
1387 | | nsCOMPtr<nsISupports> mExternal; |
1388 | | RefPtr<mozilla::dom::InstallTriggerImpl> mInstallTrigger; |
1389 | | |
1390 | | RefPtr<mozilla::dom::Storage> mLocalStorage; |
1391 | | RefPtr<mozilla::dom::Storage> mSessionStorage; |
1392 | | |
1393 | | RefPtr<mozilla::EventListenerManager> mListenerManager; |
1394 | | RefPtr<mozilla::dom::Location> mLocation; |
1395 | | RefPtr<nsHistory> mHistory; |
1396 | | RefPtr<mozilla::dom::CustomElementRegistry> mCustomElements; |
1397 | | |
1398 | | RefPtr<mozilla::dom::VisualViewport> mVisualViewport; |
1399 | | |
1400 | | nsCOMPtr<nsIPrincipal> mDocumentPrincipal; |
1401 | | // mTabChild is only ever populated in the content process. |
1402 | | nsCOMPtr<nsITabChild> mTabChild; |
1403 | | |
1404 | | uint32_t mSuspendDepth; |
1405 | | uint32_t mFreezeDepth; |
1406 | | |
1407 | | // the method that was used to focus mFocusedNode |
1408 | | uint32_t mFocusMethod; |
1409 | | |
1410 | | uint32_t mSerial; |
1411 | | |
1412 | | // The current idle request callback handle |
1413 | | uint32_t mIdleRequestCallbackCounter; |
1414 | | IdleRequests mIdleRequestCallbacks; |
1415 | | RefPtr<IdleRequestExecutor> mIdleRequestExecutor; |
1416 | | |
1417 | | #ifdef DEBUG |
1418 | | nsCOMPtr<nsIURI> mLastOpenedURI; |
1419 | | #endif |
1420 | | |
1421 | | RefPtr<nsDOMOfflineResourceList> mApplicationCache; |
1422 | | |
1423 | | using XBLPrototypeHandlerTable = nsJSThingHashtable<nsPtrHashKey<nsXBLPrototypeHandler>, JSObject*>; |
1424 | | mozilla::UniquePtr<XBLPrototypeHandlerTable> mCachedXBLPrototypeHandlers; |
1425 | | |
1426 | | RefPtr<mozilla::dom::IDBFactory> mIndexedDB; |
1427 | | |
1428 | | // This counts the number of windows that have been opened in rapid succession |
1429 | | // (i.e. within dom.successive_dialog_time_limit of each other). It is reset |
1430 | | // to 0 once a dialog is opened after dom.successive_dialog_time_limit seconds |
1431 | | // have elapsed without any other dialogs. |
1432 | | uint32_t mDialogAbuseCount; |
1433 | | |
1434 | | // This holds the time when the last modal dialog was shown. If more than |
1435 | | // MAX_DIALOG_LIMIT dialogs are shown within the time span defined by |
1436 | | // dom.successive_dialog_time_limit, we show a checkbox or confirmation prompt |
1437 | | // to allow disabling of further dialogs from this window. |
1438 | | TimeStamp mLastDialogQuitTime; |
1439 | | |
1440 | | // This flag keeps track of whether dialogs are |
1441 | | // currently enabled on this window. |
1442 | | bool mAreDialogsEnabled; |
1443 | | |
1444 | | // This flag keeps track of whether this window is currently |
1445 | | // observing DidRefresh notifications from the refresh driver. |
1446 | | bool mObservingDidRefresh; |
1447 | | // This flag keeps track of whether or not we're going through |
1448 | | // promiseDocumentFlushed resolvers. When true, promiseDocumentFlushed |
1449 | | // cannot be called. |
1450 | | bool mIteratingDocumentFlushedResolvers; |
1451 | | |
1452 | | nsTArray<uint32_t> mEnabledSensors; |
1453 | | |
1454 | | #if defined(MOZ_WIDGET_ANDROID) |
1455 | | mozilla::UniquePtr<mozilla::dom::WindowOrientationObserver> mOrientationChangeObserver; |
1456 | | #endif |
1457 | | |
1458 | | #ifdef MOZ_WEBSPEECH |
1459 | | RefPtr<mozilla::dom::SpeechSynthesis> mSpeechSynthesis; |
1460 | | #endif |
1461 | | |
1462 | | // This is the CC generation the last time we called CanSkip. |
1463 | | uint32_t mCanSkipCCGeneration; |
1464 | | |
1465 | | // The VR Displays for this window |
1466 | | nsTArray<RefPtr<mozilla::dom::VRDisplay>> mVRDisplays; |
1467 | | |
1468 | | RefPtr<mozilla::dom::VREventObserver> mVREventObserver; |
1469 | | |
1470 | | int64_t mBeforeUnloadListenerCount; |
1471 | | |
1472 | | RefPtr<mozilla::dom::IntlUtils> mIntlUtils; |
1473 | | |
1474 | | mozilla::UniquePtr<mozilla::dom::ClientSource> mClientSource; |
1475 | | |
1476 | | nsTArray<RefPtr<mozilla::dom::Promise>> mPendingPromises; |
1477 | | |
1478 | | nsTArray<mozilla::UniquePtr<PromiseDocumentFlushedResolver>> mDocumentFlushedResolvers; |
1479 | | |
1480 | | static InnerWindowByIdTable* sInnerWindowsById; |
1481 | | |
1482 | | // Members in the mChromeFields member should only be used in chrome windows. |
1483 | | // All accesses to this field should be guarded by a check of mIsChrome. |
1484 | | struct ChromeFields { |
1485 | | ChromeFields() |
1486 | | : mGroupMessageManagers(1) |
1487 | 0 | {} |
1488 | | |
1489 | | RefPtr<mozilla::dom::ChromeMessageBroadcaster> mMessageManager; |
1490 | | nsRefPtrHashtable<nsStringHashKey, |
1491 | | mozilla::dom::ChromeMessageBroadcaster> mGroupMessageManagers; |
1492 | | } mChromeFields; |
1493 | | |
1494 | | // These fields are used by the inner and outer windows to prevent |
1495 | | // programatically moving the window while the mouse is down. |
1496 | | static bool sMouseDown; |
1497 | | static bool sDragServiceDisabled; |
1498 | | |
1499 | | friend class nsDOMScriptableHelper; |
1500 | | friend class nsDOMWindowUtils; |
1501 | | friend class mozilla::dom::PostMessageEvent; |
1502 | | friend class DesktopNotification; |
1503 | | friend class mozilla::dom::TimeoutManager; |
1504 | | friend class IdleRequestExecutor; |
1505 | | friend class nsGlobalWindowOuter; |
1506 | | }; |
1507 | | |
1508 | | inline nsISupports* |
1509 | | ToSupports(nsGlobalWindowInner *p) |
1510 | 0 | { |
1511 | 0 | return static_cast<mozilla::dom::EventTarget*>(p); |
1512 | 0 | } |
1513 | | |
1514 | | inline nsISupports* |
1515 | | ToCanonicalSupports(nsGlobalWindowInner *p) |
1516 | 0 | { |
1517 | 0 | return static_cast<mozilla::dom::EventTarget*>(p); |
1518 | 0 | } |
1519 | | |
1520 | | // XXX: EWW - This is an awful hack - let's not do this |
1521 | | #include "nsGlobalWindowOuter.h" |
1522 | | |
1523 | | inline nsIGlobalObject* |
1524 | | nsGlobalWindowInner::GetOwnerGlobal() const |
1525 | 0 | { |
1526 | 0 | return const_cast<nsGlobalWindowInner*>(this); |
1527 | 0 | } |
1528 | | |
1529 | | inline nsGlobalWindowOuter* |
1530 | | nsGlobalWindowInner::GetTopInternal() |
1531 | 0 | { |
1532 | 0 | nsGlobalWindowOuter* outer = GetOuterWindowInternal(); |
1533 | 0 | nsCOMPtr<nsPIDOMWindowOuter> top = outer ? outer->GetTop() : nullptr; |
1534 | 0 | if (top) { |
1535 | 0 | return nsGlobalWindowOuter::Cast(top); |
1536 | 0 | } |
1537 | 0 | return nullptr; |
1538 | 0 | } |
1539 | | |
1540 | | inline nsGlobalWindowOuter* |
1541 | | nsGlobalWindowInner::GetScriptableTopInternal() |
1542 | 0 | { |
1543 | 0 | nsPIDOMWindowOuter* top = GetScriptableTop(); |
1544 | 0 | return nsGlobalWindowOuter::Cast(top); |
1545 | 0 | } |
1546 | | |
1547 | | inline nsIScriptContext* |
1548 | | nsGlobalWindowInner::GetContextInternal() |
1549 | 0 | { |
1550 | 0 | if (mOuterWindow) { |
1551 | 0 | return GetOuterWindowInternal()->mContext; |
1552 | 0 | } |
1553 | 0 | |
1554 | 0 | return nullptr; |
1555 | 0 | } |
1556 | | |
1557 | | inline nsGlobalWindowOuter* |
1558 | | nsGlobalWindowInner::GetOuterWindowInternal() const |
1559 | 0 | { |
1560 | 0 | return nsGlobalWindowOuter::Cast(GetOuterWindow()); |
1561 | 0 | } |
1562 | | |
1563 | | inline bool |
1564 | | nsGlobalWindowInner::IsPopupSpamWindow() |
1565 | 0 | { |
1566 | 0 | if (!mOuterWindow) { |
1567 | 0 | return false; |
1568 | 0 | } |
1569 | 0 |
|
1570 | 0 | return GetOuterWindowInternal()->mIsPopupSpam; |
1571 | 0 | } |
1572 | | |
1573 | | inline bool |
1574 | | nsGlobalWindowInner::IsFrame() |
1575 | 0 | { |
1576 | 0 | return GetParentInternal() != nullptr; |
1577 | 0 | } |
1578 | | |
1579 | | #endif /* nsGlobalWindowInner_h___ */ |