Open the subscription and submission pages subwindows, but close the
        current page if any other type of page is selected.
5162
def handle_selected_page(self):
        
        if not self.selected_page:
            pass
        if self.selected_page.name in ('subscription', 'submission'):
            # Launch page in a subwindow
            self.selected_page = self.selected_page.loop()
        elif self.selected_page.name in ('subreddit', 'inbox'):
            # Replace the current page
            self.active = False
        else:
            raise RuntimeError(self.selected_page.name)
1115223
def close(self):
        
        target = self.prev if (self.is_current and self.prev != self) else None

        with switch_window(self._browser, self.name):
            self._browser.driver.close()

        if target is not None:
            target.is_current = True
213883
function close_object() {
    $this->_pdf->restore();
    $this->_pdf->end_template();
    $this->_pdf->resume_page("pagenumber=".$this->_page_number);
  }
922781
def btn_clicked(self, widget, data=None):
        
        self.kwargs['subassistant_0'] = self.get_current_main_assistant().name
        self.kwargs['subassistant_1'] = data
        if 'subassistant_2' in self.kwargs:
            del self.kwargs['subassistant_2']
        self._open_path_window()
649705
def enable_event_listener
      @event_listener ||= lambda do |event|
        self.page = @page ? @page.getEnclosingWindow.getEnclosedPage : event.getNewPage
      end

      listener.add_listener(:web_window_event, &@event_listener)
    end
1343823
private void setCurrentPage(int page) {
        if (page >= totalPages) {
            this.currentPage = totalPages;
        } else if (page <= 1) {
            this.currentPage = 1;
        } else {
            this.currentPage = page;
        }

        // now work out where the sub-list should start and end
        startingIndex = pageSize * (currentPage -1);
        if (startingIndex < 0) {
            startingIndex = 0;
        }
        endingIndex = startingIndex + pageSize;
        if (endingIndex > list.size()) {
            endingIndex = list.size();
        }
    }
451969
@Override
	protected void onQueueBrowserClose()
	{
		super.onQueueBrowserClose();
		
		try
		{
    		CloseBrowserQuery query = new CloseBrowserQuery();
    		query.setSessionId(session.getId());
    		query.setBrowserId(id);
    		transportEndpoint.blockingRequest(query);
		}
        catch (JMSException e)
        {
            ErrorTools.log(e, log);
        }
	}
445879
static void close(SpanFunction spanFunction) {
    SpanContext current = CURRENT_SPAN.get();
    while (current != null) {
      spanFunction.apply(current.span);
      current = removeCurrentSpanInternal(current.parent);
      if (current == null || !current.autoClose) {
        return;
      }
    }
  }
67816
function windowCloseHandler(event) {
    if(!options.windowCloseWarning) {
      return;
    }

    if(sync.state !== sync.SYNC_SYNCING) {
      return;
    }

    var confirmationMessage = "Sync currently underway, are you sure you want to close?";
    (event || global.event).returnValue = confirmationMessage;

    return confirmationMessage;
  }
203216
private void selectPage(long offset) {
    if (currentBuffer == null || currentBuffer.seekSuccessful(offset)) {
      currentBuffer = null;
      int i = 0;

      // Look if the given offset is already stored in a page
      while (i < pages.size() && currentBuffer == null) {
        if (pages.get(i).seekSuccessful(offset))
          currentBuffer = pages.get(i);
        i++;
      }

      if (currentBuffer == null) {
        // If the offset is not contained in any of the loaded pages, create a new one

        // FIFO
        if (pages.size() >= MaxPages)
          pages.remove(0);
        pages.add(new InputBuffer(input));

        currentBuffer = pages.get(pages.size() - 1);
      }
    }
  }
589721
protected void openPublish() {

        HashMap<String, String> params = Maps.newHashMap();
        params.put(CmsPublishOptions.PARAM_CONTAINERPAGE, "" + CmsCoreProvider.get().getStructureId());
        params.put(CmsPublishOptions.PARAM_START_WITH_CURRENT_PAGE, "");
        params.put(CmsPublishOptions.PARAM_DETAIL, "" + m_controller.getData().getDetailId());
        CmsPublishDialog.showPublishDialog(params, new CloseHandler<PopupPanel>() {

            /**
             * @see com.google.gwt.event.logical.shared.CloseHandler#onClose(com.google.gwt.event.logical.shared.CloseEvent)
             */
            public void onClose(CloseEvent<PopupPanel> event) {

                deactivateCurrentButton();
                activateSelection();

            }
        }, new Runnable() {

            public void run() {

                openPublish();
            }

        }, m_controller.getContentEditorHandler());
    }
1161891
function(){
    if (this.isClosed) { return; }

    // allow the close to be stopped by returning `false`
    // from the `onBeforeClose` method
    var shouldClose = this.triggerMethod("before:close");
    if (shouldClose === false){
      return;
    }

    // mark as closed before doing the actual close, to
    // prevent infinite loops within "close" event handlers
    // that are trying to close other views
    this.isClosed = true;
    this.triggerMethod("close");

    // unbind UI elements
    this.unbindUIElements();

    // remove the view from the DOM
    this.remove();
  }
1268473
def close_all_pages(self):
        """"""
        state_machine_m_list = [tab['state_machine_m'] for tab in self.tabs.values()]
        for state_machine_m in state_machine_m_list:
            self.on_close_clicked(None, state_machine_m, None, force=True)
126717
function forcePageReload(registration) {
  // console.log('already controlled?', Boolean(navigator.serviceWorker.controller));

  if (!navigator.serviceWorker.controller) {
    // The window client isn't currently controlled so it's a new service
    // worker that will activate immediately.
    return;
  }

  // console.log('registration waiting?', Boolean(registration.waiting));
  if (registration.waiting) {
    // SW is waiting to activate. Can occur if multiple clients open and
    // one of the clients is refreshed.
    registration.waiting.postMessage('skipWaiting');
    return;
  }

  function listenInstalledStateChange() {
    registration.installing.addEventListener('statechange', event => {
      // console.log('statechange', event.target.state);
      if (event.target.state === 'installed' && registration.waiting) {
        // A new service worker is available, inform the user
        registration.waiting.postMessage('skipWaiting');
      } else if (event.target.state === 'activated') {
        // Force the control of the page by the activated service worker.
        window.location.reload();
      }
    });
  }

  if (registration.installing) {
    listenInstalledStateChange();
    return;
  }

  // We are currently controlled so a new SW may be found...
  // Add a listener in case a new SW is found,
  registration.addEventListener('updatefound', listenInstalledStateChange);
}
1121828
def select_subreddit(self):
        
        name = self.get_selected_item()['name']
        self.selected_page = self.open_subreddit_page(name)
488243
public void terminateSubscription(IoSession session, String heapUri, String subscriptionId, Subscription.CloseReason reason) {
        Lock heapUpdateLock = null;
        try {
            HeapState state = heapStates.get(heapUri);
            if (state != null) {
                heapUpdateLock = state.getUpdateLock();
                heapUpdateLock.lock();
            }
            subTermLock.lock();

            if (state != null) {
                if (!state.isTerminated()) {
                    state.terminateSubscription(session, subscriptionId, reason);
                    // notify client
                    if (reason == REQUESTED_BY_PUBLISHER || reason == Subscription.CloseReason.REQUESTED_BY_PUBLISHER_ADMINISTRATOR) {
                        try {
                            nioLogger.log(NioLogger.LoggingLevel.TRANSPORT, session, "Notifying client that publisher has terminated subscription %s", subscriptionId);
                            NioUtils.writeEventMessageToSession(session, new TerminateSubscription(state.getHeapId(), subscriptionId, reason.name()), objectIOFactory);
                        } catch (Exception e) {
                            // if we can't tell them about it then something more serious has just happened.
                            // the client will likely find out anyway since this will likely mean a dead session
                            // we'll just log some info to the log to aid any debugging. We won't change the closure reason.
                            LOGGER.info("Error occurred whilst trying to inform client of subscription termination", e);
                            nioLogger.log(NioLogger.LoggingLevel.SESSION, session, "Error occurred whilst trying to inform client of subscription termination, closing session");
                            // we'll request a closure of the session too to make sure everything gets cleaned up, although chances are it's already closed
                            session.close();
                        }
                    }

                    if (state.hasSubscriptions()) {
                        terminateSubscriptions(heapUri, reason);
                    } else if (state.getSubscriptions(session).isEmpty()) {
                        terminateSubscriptions(session, heapUri, reason);
                    }
                }
            }

            Multiset<String> heapsForSession = heapsByClient.get(session);
            if (heapsForSession != null) {
                heapsForSession.remove(heapUri);
                if (heapsForSession.isEmpty()) {
                    terminateSubscriptions(session, reason);
                }
            }
        } finally {
            subTermLock.unlock();
            if (heapUpdateLock != null) {
                heapUpdateLock.unlock();
            }
        }
    }
619435
public void documentComponentClosed(DocumentComponentEvent event) {
		if(logger.isDebugEnabled()){
			logger.debug("Page component "+pageComponent.getId()+" closed");
		}
		workspace.remove(pageComponent);
		((JideApplicationPage)workspace.getContext().getPage()).fireClosed(pageComponent);
	}