1 /* vim: set ts=2 sw=2 sts=2 et tw=80: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 ChromeUtils.defineESModuleGetters(lazy, {
9 E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
12 export class BrowserTabChild extends JSWindowActorChild {
17 receiveMessage(message) {
18 let context = this.manager.browsingContext;
19 let docShell = context.docShell;
21 switch (message.name) {
22 // XXX(nika): Should we try to call this in the parent process instead?
23 case "Browser:Reload":
24 /* First, we'll try to use the session history object to reload so
25 * that framesets are handled properly. If we're in a special
26 * window (such as view-source) that has no session history, fall
27 * back on using the web navigation's reload method.
29 let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
31 if (webNav.sessionHistory) {
32 webNav = webNav.sessionHistory;
36 let reloadFlags = message.data.flags;
37 if (message.data.handlingUserInput) {
38 reloadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_USER_ACTIVATION;
42 lazy.E10SUtils.wrapHandlingUserInput(
43 this.document.defaultView,
44 message.data.handlingUserInput,
45 () => webNav.reload(reloadFlags)
50 case "ForceEncodingDetection":
51 docShell.forceEncodingDetection();