### Eclipse Workspace Patch 1.0
#P drupal 7
Index: modules/overlay/overlay-child.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay-child.js,v
retrieving revision 1.8
diff -u -r1.8 overlay-child.js
--- modules/overlay/overlay-child.js	24 Apr 2010 07:14:29 -0000	1.8
+++ modules/overlay/overlay-child.js	12 May 2010 17:37:22 -0000
@@ -21,10 +21,9 @@
     }
     self.processed = true;
 
-    // If we cannot reach the parent window, then we have nothing else to do
-    // here.
-    if (!$.isPlainObject(parent.Drupal) || !$.isPlainObject(parent.Drupal.overlay)) {
-      return;
+    // If we cannot reach the parent window, break out of the overlay.
+    if (!parent.Drupal || !parent.Drupal.overlay) {
+      window.location = window.location.href.replace(/([?&]?)render=overlay&?/g, '$1').replace(/\?$/, '');
     }
 
     // If a form has been submitted successfully, then the server side script
Index: modules/overlay/overlay-parent.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay-parent.js,v
retrieving revision 1.40
diff -u -r1.40 overlay-parent.js
--- modules/overlay/overlay-parent.js	30 Apr 2010 05:25:19 -0000	1.40
+++ modules/overlay/overlay-parent.js	12 May 2010 17:37:22 -0000
@@ -336,15 +336,28 @@
   // See overlay-parent.css .overlay-loaded #overlay-element.
   self.$dialog.removeClass('overlay-loaded');
   self.$iframe.once('overlay-event-load')
-    .bind('load.overlay-event', function () {
+    .bind('load.overlay-event', function (event) {
+      var iframe = event.target;
+      var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
+      var iframeWindow = iframeDocument.defaultView || iframeDocument.parentWindow;
+      if (iframeDocument.location == 'about:blank') {
+        return;
+      }
+
       self.isLoading = false;
 
       // Only continue when overlay is still open and not closing.
       if (self.isOpen && !self.isClosing) {
-        self.$dialog.addClass('overlay-loaded');
+        // And child document is an actual overlayChild.
+        if (iframeWindow.Drupal && iframeWindow.Drupal.overlayChild) {
+          self.$dialog.addClass('overlay-loaded');
 
-        // Allow other scripts to respond to this event.
-        $(document).trigger('drupalOverlayLoad');
+          // Allow other scripts to respond to this event.
+          $(document).trigger('drupalOverlayLoad');
+        }
+        else {
+          window.location = iframeWindow.location.href.replace(/([?&]?)render=overlay&?/g, '$1').replace(/\?$/, '');
+        }
       }
       else {
         self.destroy();
