コード例 #1
0
 static {
   IIDStore.RegisterIID(nsIURI.class, MozillaVersion.VERSION_BASE, new nsID(NS_IURI_IID_STR));
   IIDStore.RegisterIID(nsIURI.class, MozillaVersion.VERSION_XR10, new nsID(NS_IURI_10_IID_STR));
 }
コード例 #2
0
  void init() {
    if (MozillaVersion.CheckVersion(MozillaVersion.VERSION_XR10)) {
      /*
       * In XULRunner versions > 4, sending WM_GETDLGCODE to a WM_KEYDOWN's MSG hwnd answers 0
       * instead of the expected DLGC_WANTALLKEYS.  This causes the default traversal framework
       * perform traversals outside of the Browser when it should not.  Hook a Traverse listener
       * to work around these problems.
       */
      browser.addListener(
          SWT.Traverse,
          event -> {
            switch (event.detail) {
              case SWT.TRAVERSE_RETURN:
                {
                  /* always veto the traversal */
                  event.doit = false;
                  break;
                }
              case SWT.TRAVERSE_TAB_NEXT:
              case SWT.TRAVERSE_TAB_PREVIOUS:
                {
                  /* veto the traversal whenever an element in the browser has focus */
                  long /*int*/[] result = new long /*int*/[1];
                  int rc = XPCOM.NS_GetServiceManager(result);
                  if (rc != XPCOM.NS_OK) Mozilla.error(rc);
                  if (result[0] == 0) Mozilla.error(XPCOM.NS_NOINTERFACE);
                  nsIServiceManager serviceManager = new nsIServiceManager(result[0]);
                  result[0] = 0;
                  byte[] aContractID =
                      MozillaDelegate.wcsToMbcs(null, XPCOM.NS_FOCUSMANAGER_CONTRACTID, true);
                  rc =
                      serviceManager.GetServiceByContractID(
                          aContractID,
                          IIDStore.GetIID(nsIFocusManager.class, MozillaVersion.VERSION_XR10),
                          result);
                  serviceManager.Release();

                  if (rc == XPCOM.NS_OK && result[0] != 0) {
                    nsIFocusManager focusManager = new nsIFocusManager(result[0]);
                    result[0] = 0;
                    rc = focusManager.GetFocusedElement(result);
                    focusManager.Release();
                    event.doit = result[0] == 0;
                    if (rc == XPCOM.NS_OK && result[0] != 0) {
                      new nsISupports(result[0]).Release();
                    }
                  }
                  break;
                }
            }
          });

      /* children created in getSiteHandle() should be destroyed whenever a page is left */
      browser.addLocationListener(
          new LocationAdapter() {
            @Override
            public void changing(LocationEvent event) {
              Iterator<Composite> it = childWindows.iterator();
              while (it.hasNext()) {
                it.next().dispose();
              }
              childWindows.clear();
            }
          });
    }
  }
コード例 #3
0
 static {
   IIDStore.RegisterIID(
       nsIX509CertValidity.class,
       MozillaVersion.VERSION_BASE,
       new nsID(NS_IX509CERTVALIDITY_IID_STR));
 }