Bug 1432047 - Move isContentFrame from contentAreaUtils.js to SeaMonkey. r=stefanh DONTBUILD CLOSED TREE
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Mon, 22 Jan 2018 08:49:11 +0100
changeset 30863 8624191ab58e13219569c078d7476b9ad682fe8f
parent 30862 603955ee98d37a04c231db0c5025f20b7d934a1b
child 30864 4f56e21c7e3ac583fa9c0154fbf48d1644f5179e
push id382
push userclokep@gmail.com
push dateMon, 12 Mar 2018 19:05:34 +0000
reviewersstefanh
bugs1432047, 1431021
Bug 1432047 - Move isContentFrame from contentAreaUtils.js to SeaMonkey. r=stefanh DONTBUILD CLOSED TREE See Bug 1431021 [Remove unused isContentFrame from contentAreaUtils.js].
editor/ui/composer/content/editorApplicationOverlay.js
suite/browser/navigator.js
--- a/editor/ui/composer/content/editorApplicationOverlay.js
+++ b/editor/ui/composer/content/editorApplicationOverlay.js
@@ -40,18 +40,22 @@ function editPageOrFrame()
 
   // if the uri is a specific frame, grab it, else use the frameset uri 
   // and let Composer handle error if necessary
   editPage(getContentFrameURI(focusedWindow));
 }
 
 function getContentFrameURI(aFocusedWindow)
 {
-  var contentFrame = isContentFrame(aFocusedWindow) ?
+  let isContentFrame = aFocusedWindow ?
+                         (aFocusedWindow.top == window.content) : false;
+
+  let contentFrame = isContentFrame ?
                        aFocusedWindow : window.content;
+
   return contentFrame.location.href;
 }
 
 // Any non-editor window wanting to create an editor with a URL
 //   should use this instead of "window.openDialog..."
 //  We must always find an existing window with requested URL
 function editPage(url, aFileType)
 {
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -2976,16 +2976,26 @@ function openCertManager()
                      "resizable,dialog=no,centerscreen");
 }
 
 function onViewSecurityContextMenu()
 {
   document.getElementById("viewCertificate").disabled = !getCert();
 }
 
+/**
+ * Determine whether or not a given focused DOMWindow is in the content area.
+ **/
+function isContentFrame(aFocusedWindow) {
+  if (!aFocusedWindow)
+    return false;
+
+  return (aFocusedWindow.top == window.content);
+}
+
 var browserDragAndDrop = {
   canDropLink: aEvent => Services.droppedLinkHandler.canDropLink(aEvent, true),
 
   dragOver(aEvent) {
     if (this.canDropLink(aEvent)) {
       aEvent.preventDefault();
     }
   },