Commit f492bcff authored by Scott's avatar Scott
Browse files

Bug 1693582 - Moving Pocket button panels to remote content process r=mconley

parent 9d399542
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -47,16 +47,16 @@ class AboutPocketParent extends JSWindowActorParent {
      case "PKT_openTabWithUrl": {
        this.browsingContext.topChromeWindow?.pktUI.onOpenTabWithUrl(
          message.data,
          this.browsingContext.embedderElement.contentDocument.nodePrincipal,
          this.browsingContext.embedderElement.contentDocument.csp
          this.browsingContext.embedderElement.contentPrincipal,
          this.browsingContext.embedderElement.csp
        );
        break;
      }
      case "PKT_openTabWithPocketUrl": {
        this.browsingContext.topChromeWindow?.pktUI.onOpenTabWithPocketUrl(
          message.data,
          this.browsingContext.embedderElement.contentDocument.nodePrincipal,
          this.browsingContext.embedderElement.contentDocument.csp
          this.browsingContext.embedderElement.contentPrincipal,
          this.browsingContext.embedderElement.csp
        );
        break;
      }
+1 −1
Original line number Diff line number Diff line
@@ -404,7 +404,7 @@
    </vbox>
  </panelview>

  <panelview id="PanelUI-savetopocket" flex="1" class="PanelUI-subView">
  <panelview id="PanelUI-savetopocket" flex="1" class="PanelUI-subView" remote="true">
    <vbox class="PanelUI-savetopocket-container">
    </vbox>
  </panelview>
+5 −0
Original line number Diff line number Diff line
@@ -463,6 +463,11 @@ const PanelUI = {
      let tempPanel = document.createXULElement("panel");
      tempPanel.setAttribute("type", "arrow");
      tempPanel.setAttribute("id", "customizationui-widget-panel");

      if (viewNode.getAttribute("remote") == "true") {
        tempPanel.setAttribute("remote", "true");
      }

      tempPanel.setAttribute("class", "cui-widget-panel panel-no-padding");
      tempPanel.setAttribute("viewId", aViewId);
      if (aAnchor.getAttribute("tabspecific")) {
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ var PocketCustomizableWidget = {
        let frame = doc.createXULElement("browser");

        frame.setAttribute("type", "content");
        frame.setAttribute("remote", true);
        panelNode.appendChild(frame);

        SaveToPocket.onShownInToolbarPanel(panelNode, frame);
+2 −36
Original line number Diff line number Diff line
@@ -570,7 +570,8 @@ var pktUIMessaging = (function() {
   */
  function sendMessageToPanel(messageId, payload) {
    var panelFrame = pktUI.getPanelFrame();
    if (!isPocketPanelFrameValid(panelFrame)) {
    if (!panelFrame) {
      console.warn("Pocket panel frame is undefined");
      return;
    }

@@ -591,41 +592,6 @@ var pktUIMessaging = (function() {
    sendMessageToPanel(messageId, errorResponse);
  }

  /**
   * Validation
   */

  function isPocketPanelFrameValid(panelFrame) {
    // Check if panel is available if not throw a warning and bailout.
    // We likely try to send to a panel that is not visible anymore
    if (typeof panelFrame === "undefined") {
      console.warn("Pocket panel frame is undefined");
      return false;
    }

    var contentWindow = panelFrame.contentWindow;
    if (typeof contentWindow == "undefined") {
      console.warn("Pocket panel frame content window is undefined");
      return false;
    }

    var doc = contentWindow.document;
    if (typeof doc === "undefined") {
      console.warn("Pocket panel frame content window document is undefined");
      return false;
    }

    var documentElement = doc.documentElement;
    if (typeof documentElement === "undefined") {
      console.warn(
        "Pocket panel frame content window document document element is undefined"
      );
      return false;
    }

    return true;
  }

  /**
   * Public
   */
Loading