org.eclipse.swt.win32.win32.x86_3.7.2.v3740f

ed()) {
                  return;
                }
                if ((globalDispatch != 0) && (dispatch.getAddress() == globalDispatch))
                {
                  globalDispatch = 0;
                  
                  IE ie = (IE)browserwebBrowser;
                  if (installFunctionsOnDocumentComplete)
                  {
                    installFunctionsOnDocumentComplete = false;
                    Enumeration elements = functions.elements();
                    while (elements.hasMoreElements())
                    {
                      BrowserFunction function = (BrowserFunction)elements.nextElement();
                      execute(functionString);
                    }
                  }
                  ProgressEvent progressEvent = new ProgressEvent(IE.this.browser);
                  display = IE.this.browser.getDisplay();
                  widget = IE.this.browser;
                  for (int i = 0; i < progressListeners.length; i++) {
                    progressListeners[i].completed(progressEvent);
                  }
                }
              }
            }
            break;
          case 104: 
            if ((goto 3389) && 
            
              (isRefresh))
            {
              isRefresh = false;
              
              Enumeration elements = functions.elements();
              while (elements.hasMoreElements())
              {
                BrowserFunction function = (BrowserFunction)elements.nextElement();
                execute(functionString);
              }
              ProgressEvent progressEvent = new ProgressEvent(IE.this.browser);
              display = IE.this.browser.getDisplay();
              widget = IE.this.browser;
              for (int i = 0; i < progressListeners.length; i++) {
                progressListeners[i].completed(progressEvent);
              }
            }
            break;
          case 252: 
            Variant varResult = arguments[1];
            String url = varResult.getString();
            if (!performingInitialNavigate) {
              isAboutBlank = url.startsWith("about:blank");
            }
            boolean isPDF = false;
            String path = null;
            try
            {
              path = new URL(url).getPath();
            }
            catch (MalformedURLException localMalformedURLException) {}
            if (path != null)
            {
              int extensionIndex = path.lastIndexOf('.');
              if (extensionIndex != -1)
              {
                String extension = path.substring(extensionIndex);
                if (extension.equalsIgnoreCase(".pdf"))
                {
                  isPDF = true;
                  IE.PDFCount += 1;
                  if (IE.PDFCount > 20) {
                    COM.FreeUnusedLibraries = false;
                  }
                }
              }
            }
            if (uncRedirect != null)
            {
              if (uncRedirect.equals(url)) {
                uncRedirect = null;
              } else if (uncRedirect.startsWith(url)) {
                navigate(uncRedirect, null, null, true);
              } else {
                uncRedirect = null;
              }
            }
            else
            {
              varResult = arguments[0];
              IDispatch dispatch = varResult.getDispatch();
              if (globalDispatch == 0) {
                globalDispatch = dispatch.getAddress();
              }
              OleAutomation webBrowser = varResult.getAutomation();
              Variant variant = new Variant(auto);
              IDispatch top = variant.getDispatch();
              boolean isTop = top.getAddress() == dispatch.getAddress();
              if (isTop)
              {
                unhookDOMListeners(documents);
                for (int i = 0; i < documents.length; i++) {
                  documents[i].dispose();
                }
                documents = new OleAutomation[0];
                
                Enumeration elements = functions.elements();
                while (elements.hasMoreElements())
                {
                  BrowserFunction function = (BrowserFunction)elements.nextElement();
                  execute(functionString);
                }
              }
              if (!isPDF) {
                hookDOMListeners(webBrowser, isTop);
              }
              webBrowser.dispose();
            }
            break;
          case 271: 
            if (uncRedirect != null)
            {
              uncRedirect = null;
            }
            else
            {
              Variant varResult = arguments[1];
              String url = varResult.getString();
              if (url.startsWith("\\\\"))
              {
                varResult = arguments[3];
                int statusCode = varResult.getInt();
                if (statusCode == -2146697211)
                {
                  int index = url.indexOf('\\', 2);
                  if (index != -1)
                  {
                    String host = url.substring(0, index);
                    Variant cancel = arguments[4];
                    if (cancel != null)
                    {
                      int pCancel = cancel.getByRef();
                      COM.MoveMemory(pCancel, new short[] { -1 }, 2);
                    }
                    IE.this.browser.getDisplay().asyncExec(new IE.9(this, url, host));
                  }
                }
              }
            }
            break;
          case 251: 
            Variant cancel = arguments[1];
            int pCancel = cancel.getByRef();
            WindowEvent newEvent = new WindowEvent(IE.this.browser);
            display = IE.this.browser.getDisplay();
            widget = IE.this.browser;
            required = false;
            for (int i = 0; i < openWindowListeners.length; i++) {
              openWindowListeners[i].open(newEvent);
            }
            IE browser = null;
            if ((browser != null) && ((browser.webBrowser instanceof IE))) {
              browser = (IE)browser.webBrowser;
            }
            boolean doit = (browser != null) && (!browser.isDisposed());
            if (doit)
            {
              installFunctionsOnDocumentComplete = true;
              
              Variant variant = new Variant(auto);
              IDispatch iDispatch = variant.getDispatch();
              Variant ppDisp = arguments[0];
              int byref = ppDisp.getByRef();
              if (byref != 0) {
                COM.MoveMemory(byref, new int[] { iDispatch.getAddress() }, OS.PTR_SIZEOF);
              }
            }
            if (required) {
              COM.MoveMemory(pCancel, new short[] { doit ? 0 : -1 }, 2);
            }
            break;
          case 256: 
            Variant arg0 = arguments[0];
            menuBar = arg0.getBoolean();
            break;
          case 257: 
            Variant arg0 = arguments[0];
            statusBar = arg0.getBoolean();
            break;
          case 255: 
            Variant arg0 = arguments[0];
            toolBar = arg0.getBoolean();
            if (!toolBar)
            {
              addressBar = false;
              menuBar = false;
            }
            break;
          case 254: 
            Variant arg1 = arguments[0];
            boolean visible = arg1.getBoolean();
            WindowEvent newEvent = new WindowEvent(IE.this.browser);
            display = IE.this.browser.getDisplay();
            widget = IE.this.browser;
            if (visible)
            {
              if (addressBar)
              {
                int[] rgdispid = auto.getIDsOfNames(new String[] { "AddressBar" });
                Variant pVarResult = auto.getProperty(rgdispid[0]);
                if (pVarResult != null)
                {
                  if (pVarResult.getType() == 11) {
                    addressBar = pVarResult.getBoolean();
                  }
                  pVarResult.dispose();
                }
              }
              addressBar = addressBar;
              menuBar = menuBar;
              statusBar = statusBar;
              toolBar = toolBar;
              location = location;
              size = size;
              for (int i = 0; i < visibilityWindowListeners.length; i++) {
                visibilityWindowListeners[i].show(newEvent);
              }
              location = null;
              size = null;
            }
            else
            {
              for (int i = 0; i < visibilityWindowListeners.length; i++) {
                visibilityWindowListeners[i].hide(newEvent);
              }
            }
            break;
          case 108: 
            if ((goto 3389) && 
            
              (!performingInitialNavigate))
            {
              Variant arg1 = arguments[0];
              int nProgress = arg1.getType() != 3 ? 0 : arg1.getInt();
              Variant arg2 = arguments[1];
              int nProgressMax = arg2.getType() != 3 ? 0 : arg2.getInt();
              ProgressEvent newEvent = new ProgressEvent(IE.this.browser);
              display = IE.this.browser.getDisplay();
              widget = IE.this.browser;
              current = nProgress;
              total = nProgressMax;
              if (nProgress != -1) {
                for (int i = 0; i < progressListeners.length; i++) {
                  progressListeners[i].changed(newEvent);
                }
              }
            }
            break;
          case 102: 
            if ((goto 3389) && 
            
              (!performingInitialNavigate))
            {
              Variant arg1 = arguments[0];
              if (arg1.getType() == 8)
              {
                String text = arg1.getString();
                StatusTextEvent newEvent = new StatusTextEvent(IE.this.browser);
                display = IE.this.browser.getDisplay();
                widget = IE.this.browser;
                text = text;
                for (int i = 0; i < statusTextListeners.length; i++) {
                  statusTextListeners[i].changed(newEvent);
                }
              }
            }
            break;
          case 113: 
            if ((goto 3389) && 
            
              (!performingInitialNavigate))
            {
              Variant arg1 = arguments[0];
              if (arg1.getType() == 8)
              {
                String title = arg1.getString();
                TitleEvent newEvent = new TitleEvent(IE.this.browser);
                display = IE.this.browser.getDisplay();
                widget = IE.this.browser;
                title = title;
                for (int i = 0; i < titleListeners.length; i++) {
                  titleListeners[i].changed(newEvent);
                }
              }
            }
            break;
          case 263: 
            IE.this.browser.getDisplay().asyncExec(new IE.10(this));
            
            Variant cancel = arguments[1];
            int pCancel = cancel.getByRef();
            Variant arg1 = arguments[0];
            boolean isChildWindow = arg1.getBoolean();
            COM.MoveMemory(pCancel, new short[] { isChildWindow ? 0 : -1 }, 2);
            break;
          case 267: 
            if (size == null) {
              size = new Point(0, 0);
            }
            Variant arg1 = arguments[0];
            size.y = arg1.getInt();
            break;
          case 264: 
            if (location == null) {
              location = new Point(0, 0);
            }
            Variant arg1 = arguments[0];
            location.x = arg1.getInt();
            break;
          case 265: 
            if (location == null) {
              location = new Point(0, 0);
            }
            Variant arg1 = arguments[0];
            location.y = arg1.getInt();
            break;
          case 266: 
            if (size == null) {
              size = new Point(0, 0);
            }
            Variant arg1 = arguments[0];
            size.x = arg1.getInt();
          }
        }
        Variant[] arguments = arguments;
        for (int i = 0; i < arguments.length; i++) {
          arguments[i].dispose();
        }
      }
    };
    site.addEventListener(250, oleListener);
    site.addEventListener(105, oleListener);
    site.addEventListener(259, oleListener);
    site.addEventListener(104, oleListener);
    site.addEventListener(252, oleListener);
    site.addEventListener(271, oleListener);
    site.addEventListener(251, oleListener);
    site.addEventListener(256, oleListener);
    site.addEventListener(257, oleListener);
    site.addEventListener(255, oleListener);
    site.addEventListener(254, oleListener);
    site.addEventListener(108, oleListener);
    site.addEventListener(102, oleListener);
    site.addEventListener(113, oleListener);
    site.addEventListener(263, oleListener);
    site.addEventListener(267, oleListener);
    site.addEventListener(264, oleListener);
    site.addEventListener(265, oleListener);
    site.addEventListener(266, oleListener);
    
    Variant variant = new Variant(true);
    auto.setProperty(552, variant);
    variant.dispose();
    
    variant = new Variant(false);
    int[] rgdispid = auto.getIDsOfNames(new String[] { "RegisterAsDropTarget" });
    if (rgdispid != null) {
      auto.setProperty(rgdispid[0], variant);
    }
    variant.dispose();
  }
  
  public boolean back()
  {
    if (!back) {
      return false;
    }
    int[] rgdispid = auto.getIDsOfNames(new String[] { "GoBack" });
    Variant pVarResult = auto.invoke(rgdispid[0]);
    return (pVarResult != null) && (pVarResult.getType() == 0);
  }
  
  public boolean close()
  {
    boolean result = true;
    int[] rgdispid = auto.getIDsOfNames(new String[] { "Document" });
    int dispIdMember = rgdispid[0];
    Variant pVarResult = auto.getProperty(dispIdMember);
    if ((pVarResult == null) || (pVarResult.getType() == 0))
    {
      if (pVarResult != null) {
        pVarResult.dispose();
      }
    }
    else
    {
      OleAutomation document = pVarResult.getAutomation();
      pVarResult.dispose();
      rgdispid = document.getIDsOfNames(new String[] { "parentWindow" });
      if (rgdispid != null)
      {
        dispIdMember = rgdispid[0];
        pVarResult = document.getProperty(dispIdMember);
        if ((pVarResult == null) || (pVarResult.getType() == 0))
        {
          if (pVarResult != null) {
            pVarResult.dispose();
          }
        }
        else
        {
          OleAutomation window = pVarResult.getAutomation();
          pVarResult.dispose();
          rgdispid = window.getIDsOfNames(new String[] { "location" });
          dispIdMember = rgdispid[0];
          pVarResult = window.getProperty(dispIdMember);
          if ((pVarResult == null) || (pVarResult.getType() == 0))
          {
            if (pVarResult != null) {
              pVarResult.dispose();
            }
          }
          else
          {
            OleAutomation location = pVarResult.getAutomation();
            pVarResult.dispose();
            LocationListener[] oldListeners = locationListeners;
            locationListeners = new LocationListener[0];
            rgdispid = location.getIDsOfNames(new String[] { "replace" });
            dispIdMember = rgdispid[0];
            Variant[] args = { new Variant("about:blank") };
            pVarResult = location.invoke(dispIdMember, args);
            if (pVarResult == null) {
              result = false;
            } else {
              pVarResult.dispose();
            }
            args[0].dispose();
            locationListeners = oldListeners;
            location.dispose();
          }
          window.dispose();
        }
      }
      document.dispose();
    }
    return result;
  }
  
  static Variant createSafeArray(String string)
  {
    byte[] bytes = string.getBytes();
    int length = bytes.length;
    int pvData = OS.GlobalAlloc(64, length);
    C.memmove(pvData, bytes, length);
    int cElements1 = length;
    
    int pSafeArray = OS.GlobalAlloc(64, SAFEARRAY.sizeof);
    SAFEARRAY safeArray = new SAFEARRAY();
    cDims = 1;
    fFeatures = 16;
    cbElements = 1;
    pvData = pvData;
    SAFEARRAYBOUND safeArrayBound = new SAFEARRAYBOUND();
    rgsabound = safeArrayBound;
    cElements = cElements1;
    OS.MoveMemory(pSafeArray, safeArray, SAFEARRAY.sizeof);
    
    int pVariant = OS.GlobalAlloc(64, Variant.sizeof);
    short vt = 8209;
    OS.MoveMemory(pVariant, new short[] { vt }, 2);
    OS.MoveMemory(pVariant + 8, new int[] { pSafeArray }, C.PTR_SIZEOF);
    return new Variant(pVariant, (short)16396);
  }
  
  public boolean execute(String script)
  {
    int[] rgdispid = auto.getIDsOfNames(new String[] { "Document" });
    int dispIdMember = rgdispid[0];
    Variant pVarResult = auto.getProperty(dispIdMember);
    if ((pVarResult == null) || (pVarResult.getType() == 0))
    {
      if (pVarResult != null) {
        pVarResult.dispose();
      }
      return false;
    }
    OleAutomation document = pVarResult.getAutomation();
    pVarResult.dispose();
    
    rgdispid = document.getIDsOfNames(new String[] { "parentWindow" });
    if (rgdispid == null)
    {
      document.dispose();
      return false;
    }
    dispIdMember = rgdispid[0];
    pVarResult = document.getProperty(dispIdMember);
    OleAutomation ihtmlWindow2 = pVarResult.getAutomation();
    pVarResult.dispose();
    document.dispose();
    
    rgdispid = ihtmlWindow2.getIDsOfNames(new String[] { "execScript", "code" });
    Variant[] rgvarg = new Variant[1];
    rgvarg[0] = new Variant(script);
    int[] rgdispidNamedArgs = new int[1];
    rgdispidNamedArgs[0] = rgdispid[1];
    pVarResult = ihtmlWindow2.invoke(rgdispid[0], rgvarg, rgdispidNamedArgs);
    rgvarg[0].dispose();
    ihtmlWindow2.dispose();
    if (pVarResult == null) {
      return false;
    }
    pVarResult.dispose();
    return true;
  }
  
  public boolean forward()
  {
    if (!forward) {
      return false;
    }
    int[] rgdispid = auto.getIDsOfNames(new String[] { "GoForward" });
    Variant pVarResult = auto.invoke(rgdispid[0]);
    return (pVarResult != null) && (pVarResult.getType() == 0);
  }
  
  public String getBrowserType()
  {
    return "ie";
  }
  
  String getDeleteFunctionString(String functionName)
  {
    return "window." + functionName + "=undefined";
  }
  
  public String getText()
  {
    int[] rgdispid = auto.getIDsOfNames(new String[] { "Document" });
    Variant pVarResult = auto.getProperty(rgdispid[0]);
    if ((pVarResult == null) || (pVarResult.getType() == 0))
    {
      if (pVarResult != null) {
        pVarResult.dispose();
      }
      return "";
    }
    OleAutomation document = pVarResult.getAutomation();
    pVarResult.dispose();
    
    rgdispid = document.getIDsOfNames(new String[] { "documentElement" });
    if (rgdispid == null)
    {
      document.dispose();
      return "";
    }
    pVarResult = document.getProperty(rgdispid[0]);
    document.dispose();
    if ((pVarResult == null) || (pVarResult.getType() == 0))
    {
      if (pVarResult != null) {
        pVarResult.dispose();
      }
      return "";
    }
    OleAutomation element = pVarResult.getAutomation();
    pVarResult.dispose();
    
    rgdispid = element.getIDsOfNames(new String[] { "outerHTML" });
    pVarResult = element.getProperty(rgdispid[0]);
    element.dispose();
    if ((pVarResult == null) || (pVarResult.getType() == 0))
    {
      if (pVarResult != null) {
        pVarResult.dispose();
      }
      return "";
    }
    String result = pVarResult.getString();
    pVarResult.dispose();
    
    return result;
  }
  
  public String getUrl()
  {
    String result = _getUrl();
    return result.length() != 0 ? result : "about:blank";
  }
  
  String _getUrl()
  {
    int[] rgdispid = auto.getIDsOfNames(new String[] { "LocationURL" });
    Variant pVarResult = auto.getProperty(rgdispid[0]);
    if ((pVarResult == null) || (pVarResult.getType() != 8)) {
      return "";
    }
    String result = pVarResult.getString();
    pVarResult.dispose();
    return result;
  }
  
  public boolean isBackEnabled()
  {
    return back;
  }
  
  public boolean isForwardEnabled()
  {
    return forward;
  }
  
  public boolean isFocusControl()
  {
    return (site.isFocusControl()) || (frame.isFocusControl());
  }
  
  boolean navigate(String url, String postData, String[] headers, boolean silent)
  {
    int count = 1;
    if (postData != null) {
      count++;
    }
    if (headers != null) {
      count++;
    }
    Variant[] rgvarg = new Variant[count];
    int[] rgdispidNamedArgs = new int[count];
    int[] rgdispid = auto.getIDsOfNames(new String[] { "Navigate", "URL", "PostData", "Headers" });
    int index = 0;
    rgvarg[index] = new Variant(url);
    rgdispidNamedArgs[(index++)] = rgdispid[1];
    if (postData != null)
    {
      rgvarg[index] = createSafeArray(postData);
      rgdispidNamedArgs[(index++)] = rgdispid[2];
    }
    if (headers != null)
    {
      StringBuffer buffer = new StringBuffer();
      for (int i = 0; i < headers.length; i++)
      {
        String current = headers[i];
        if (current != null)
        {
          int sep = current.indexOf(':');
          if (sep != -1)
          {
            String key = current.substring(0, sep).trim();
            String value = current.substring(sep + 1).trim();
            if ((key.length() > 0) && (value.length() > 0))
            {
              buffer.append(key);
              buffer.append(':');
              buffer.append(value);
              buffer.append("\r\n");
            }
          }
        }
      }
      rgvarg[index] = new Variant(buffer.toString());
      rgdispidNamedArgs[(index++)] = rgdispid[3];
    }
    boolean oldValue = false;
    if ((silent) && (!OS.IsWinCE) && (IEVersion >= 7))
    {
      int hResult = OS.CoInternetIsFeatureEnabled(21, 2);
      oldValue = hResult == 0;
      OS.CoInternetSetFeatureEnabled(21, 2, true);
    }
    Variant pVarResult = auto.invoke(rgdispid[0], rgvarg, rgdispidNamedArgs);
    if ((silent) && (!OS.IsWinCE) && (IEVersion >= 7)) {
      OS.CoInternetSetFeatureEnabled(21, 2, oldValue);
    }
    for (int i = 0; i < count; i++) {
      rgvarg[i].dispose();
    }
    if (pVarResult == null) {
      return false;
    }
    boolean result = pVarResult.getType() == 0;
    pVarResult.dispose();
    return result;
  }
  
  public void refresh()
  {
    uncRedirect = null;
    
    String url = _getUrl();
    int extensionIndex = url.lastIndexOf('.');
    if (extensionIndex != -1)
    {
      String extension = url.substring(extensionIndex);
      if (extension.equalsIgnoreCase(".pdf"))
      {
        PDFCount += 1;
        if (PDFCount > 20) {
          COM.FreeUnusedLibraries = false;
        }
      }
    }
    isRefresh = true;
    int[] rgdispid = auto.getIDsOfNames(new String[] { "Refresh" });
    auto.invoke(rgdispid[0]);
  }
  
  void setHTML(String string)
  {
    int charCount = string.length();
    char[] chars = new char[charCount];
    string.getChars(0, charCount, chars, 0);
    int byteCount = OS.WideCharToMultiByte(65001, 0, chars, charCount, null, 0, null, null);
    
    byte[] UTF8BOM = { -17, -69, -65 };
    int hGlobal = OS.GlobalAlloc(64, UTF8BOM.length + byteCount);
    if (hGlobal != 0)
    {
      OS.MoveMemory(hGlobal, UTF8BOM, UTF8BOM.length);
      OS.WideCharToMultiByte(65001, 0, chars, charCount, hGlobal + UTF8BOM.length, byteCount, null, null);
      int[] ppstm = new int[1];
      if (OS.CreateStreamOnHGlobal(hGlobal, true, ppstm) == 0)
      {
        int[] rgdispid = auto.getIDsOfNames(new String[] { "Document" });
        Variant pVarResult = auto.getProperty(rgdispid[0]);
        IDispatch dispatchDocument = pVarResult.getDispatch();
        int[] ppvObject = new int[1];
        int result = dispatchDocument.QueryInterface(COM.IIDIPersistStreamInit, ppvObject);
        if (result == 0)
        {
          IPersistStreamInit persistStreamInit = new IPersistStreamInit(ppvObject[0]);
          if (persistStreamInit.InitNew() == 0) {
            persistStreamInit.Load(ppstm[0]);
          }
          persistStreamInit.Release();
        }
        pVarResult.dispose();
        
        IUnknown stream = new IUnknown(ppstm[0]);
        stream.Release();
      }
      else
      {
        OS.GlobalFree(hGlobal);
      }
    }
  }
  
  public boolean setText(String html, boolean trusted)
  {
    if (performingInitialNavigate)
    {
      pendingText = new Object[] { html, new Boolean(trusted) };
      pendingUrl = null;
      return true;
    }
    boolean blankLoading = this.html != null;
    this.html = html;
    untrustedText = (!trusted);
    if (blankLoading) {
      return true;
    }
    if (_getUrl().length() != 0)
    {
      int[] rgdispid = auto.getIDsOfNames(new String[] { "ReadyState" });
      Variant pVarResult = auto.getProperty(rgdispid[0]);
      if (pVarResult == null) {
        return false;
      }
      delaySetText = (pVarResult.getInt() != 4);
      pVarResult.dispose();
      rgdispid = auto.getIDsOfNames(new String[] { "Stop" });
      auto.invoke(rgdispid[0]);
    }
    int[] rgdispid = auto.getIDsOfNames(new String[] { "Navigate", "URL" });
    Variant[] rgvarg = new Variant[1];
    rgvarg[0] = new Variant("about:blank");
    int[] rgdispidNamedArgs = new int[1];
    rgdispidNamedArgs[0] = rgdispid[1];
    boolean oldValue = false;
    if ((!OS.IsWinCE) && (IEVersion >= 7))
    {
      int hResult = OS.CoInternetIsFeatureEnabled(21, 2);
      oldValue = hResult == 0;
      OS.CoInternetSetFeatureEnabled(21, 2, true);
    }
    Variant pVarResult = auto.invoke(rgdispid[0], rgvarg, rgdispidNamedArgs);
    if ((!OS.IsWinCE) && (IEVersion >= 7)) {
      OS.CoInternetSetFeatureEnabled(21, 2, oldValue);
    }
    rgvarg[0].dispose();
    if (pVarResult == null) {
      return false;
    }
    boolean result = pVarResult.getType() == 0;
    pVarResult.dispose();
    return result;
  }
  
  public boolean setUrl(String url, String postData, String[] headers)
  {
    html = (uncRedirect = null);
    if ((_getUrl().length() == 0) && (!"about:blank".equalsIgnoreCase(url)))
    {
      pendingText = null;
      pendingUrl = new Object[] { url, postData, headers };
      performingInitialNavigate = true;
      navigate("about:blank", null, null, true);
      return true;
    }
    if (url.endsWith(".xml"))
    {
      int[] rgdispid = auto.getIDsOfNames(new String[] { "Stop" });
      auto.invoke(rgdispid[0]);
    }
    return navigate(url, postData, headers, false);
  }
  
  public void stop()
  {
    if (performingInitialNavigate)
    {
      pendingText = (pendingUrl = null);
      return;
    }
    if (_getUrl().length() == 0) {
      return;
    }
    uncRedirect = null;
    int[] rgdispid = auto.getIDsOfNames(new String[] { "Stop" });
    auto.invoke(rgdispid[0]);
  }
  
  boolean translateMnemonics()
  {
    return false;
  }
  
  void handleDOMEvent(OleEvent e)
  {
    if ((arguments == null) || (arguments.length == 0)) {
      return;
    }
    Variant arg = arguments[0];
    OleAutomation event = arg.getAutomation();
    int[] rgdispid = event.getIDsOfNames(new String[] { "type" });
    int dispIdMember = rgdispid[0];
    Variant pVarResult = event.getProperty(dispIdMember);
    String eventType = pVarResult.getString();
    pVarResult.dispose();
    if (eventType.equals("keydown"))
    {
      rgdispid = event.getIDsOfNames(new String[] { "keyCode" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      lastKeyCode = translateKey(pVarResult.getInt());
      pVarResult.dispose();
      
      rgdispid = event.getIDsOfNames(new String[] { "returnValue" });
      pVarResult = event.getProperty(rgdispid[0]);
      boolean consume = (pVarResult != null) && (pVarResult.getType() == 11) && (!pVarResult.getBoolean());
      pVarResult.dispose();
      
      MSG msg = new MSG();
      int flags = 0x2 | (consume ? 1 : 0);
      if (OS.PeekMessage(msg, frame.handle, 258, 258, flags))
      {
        event.dispose();
        return;
      }
      if (consume)
      {
        event.dispose();
        return;
      }
      rgdispid = event.getIDsOfNames(new String[] { "repeat" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      boolean repeating = pVarResult.getBoolean();
      pVarResult.dispose();
      if (repeating)
      {
        event.dispose();
        return;
      }
      int mask = 0;
      rgdispid = event.getIDsOfNames(new String[] { "altKey" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      if (pVarResult.getBoolean()) {
        mask |= 0x10000;
      }
      pVarResult.dispose();
      
      rgdispid = event.getIDsOfNames(new String[] { "ctrlKey" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      if (pVarResult.getBoolean()) {
        mask |= 0x40000;
      }
      pVarResult.dispose();
      
      rgdispid = event.getIDsOfNames(new String[] { "shiftKey" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      if (pVarResult.getBoolean()) {
        mask |= 0x20000;
      }
      pVarResult.dispose();
      
      Event keyEvent = new Event();
      widget = browser;
      type = 1;
      keyCode = lastKeyCode;
      stateMask = mask;
      stateMask &= (lastKeyCode ^ 0xFFFFFFFF);
      switch (lastKeyCode)
      {
      case 8: 
        lastCharCode = (character = 8); break;
      case 13: 
        lastCharCode = (character = 13); break;
      case 127: 
        lastCharCode = (character = 127); break;
      case 9: 
        lastCharCode = (character = 9);
      }
      if (!sendKeyEvent(keyEvent))
      {
        rgdispid = event.getIDsOfNames(new String[] { "returnValue" });
        dispIdMember = rgdispid[0];
        Variant pVarFalse = new Variant(false);
        event.setProperty(dispIdMember, pVarFalse);
        pVarFalse.dispose();
      }
      if (lastKeyCode == 16777230) {
        isRefresh = true;
      }
      event.dispose();
      return;
    }
    if (eventType.equals("keypress"))
    {
      int mask = 0;
      rgdispid = event.getIDsOfNames(new String[] { "ctrlKey" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      if (pVarResult.getBoolean()) {
        mask |= 0x40000;
      }
      pVarResult.dispose();
      
      rgdispid = event.getIDsOfNames(new String[] { "shiftKey" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      if (pVarResult.getBoolean()) {
        mask |= 0x20000;
      }
      pVarResult.dispose();
      
      rgdispid = event.getIDsOfNames(new String[] { "altKey" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      if (pVarResult.getBoolean()) {
        mask |= 0x10000;
      }
      pVarResult.dispose();
      
      rgdispid = event.getIDsOfNames(new String[] { "keyCode" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      lastCharCode = pVarResult.getInt();
      pVarResult.dispose();
      if ((lastCharCode == 13) || (lastCharCode == 10))
      {
        event.dispose();
        return;
      }
      Event keyEvent = new Event();
      widget = browser;
      type = 1;
      keyCode = lastKeyCode;
      character = ((char)lastCharCode);
      stateMask = mask;
      if (!sendKeyEvent(keyEvent))
      {
        rgdispid = event.getIDsOfNames(new String[] { "returnValue" });
        dispIdMember = rgdispid[0];
        Variant pVarFalse = new Variant(false);
        event.setProperty(dispIdMember, pVarFalse);
        pVarFalse.dispose();
      }
      event.dispose();
      return;
    }
    if (eventType.equals("keyup"))
    {
      rgdispid = event.getIDsOfNames(new String[] { "keyCode" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      int keyCode = translateKey(pVarResult.getInt());
      pVarResult.dispose();
      if (keyCode == 0)
      {
        lastKeyCode = (lastCharCode = 0);
        event.dispose();
        return;
      }
      if (keyCode != lastKeyCode)
      {
        lastKeyCode = keyCode;
        lastCharCode = 0;
      }
      int mask = 0;
      rgdispid = event.getIDsOfNames(new String[] { "ctrlKey" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      if (pVarResult.getBoolean()) {
        mask |= 0x40000;
      }
      pVarResult.dispose();
      
      rgdispid = event.getIDsOfNames(new String[] { "altKey" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      if (pVarResult.getBoolean()) {
        mask |= 0x10000;
      }
      pVarResult.dispose();
      
      rgdispid = event.getIDsOfNames(new String[] { "shiftKey" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      if (pVarResult.getBoolean()) {
        mask |= 0x20000;
      }
      pVarResult.dispose();
      
      Event keyEvent = new Event();
      widget = browser;
      type = 2;
      keyCode = lastKeyCode;
      character = ((char)lastCharCode);
      stateMask = mask;
      switch (lastKeyCode)
      {
      case 65536: 
      case 131072: 
      case 262144: 
      case 4194304: 
        stateMask |= lastKeyCode;
      }
      browser.notifyListeners(type, keyEvent);
      if (!doit)
      {
        rgdispid = event.getIDsOfNames(new String[] { "returnValue" });
        dispIdMember = rgdispid[0];
        Variant pVarFalse = new Variant(false);
        event.setProperty(dispIdMember, pVarFalse);
        pVarFalse.dispose();
      }
      lastKeyCode = (lastCharCode = 0);
      event.dispose();
      return;
    }
    if (eventType.equals("mouseover"))
    {
      rgdispid = event.getIDsOfNames(new String[] { "fromElement" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      boolean isInternal = pVarResult.getType() != 0;
      pVarResult.dispose();
      if (isInternal)
      {
        event.dispose();
        return;
      }
    }
    if (eventType.equals("mouseout"))
    {
      rgdispid = event.getIDsOfNames(new String[] { "toElement" });
      dispIdMember = rgdispid[0];
      pVarResult = event.getProperty(dispIdMember);
      boolean isInternal = pVarResult.getType() != 0;
      pVarResult.dispose();
      if (isInternal)
      {
        event.dispose();
        return;
      }
    }
    int mask = 0;
    Event newEvent = new Event();
    widget = browser;
    
    rgdispid = event.getIDsOfNames(new String[] { "screenX" });
    dispIdMember = rgdispid[0];
    pVarResult = event.getProperty(dispIdMember);
    int screenX = pVarResult.getInt();
    pVarResult.dispose();
    
    rgdispid = event.getIDsOfNames(new String[] { "screenY" });
    dispIdMember = rgdispid[0];
    pVarResult = event.getProperty(dispIdMember);
    int screenY = pVarResult.getInt();
    pVarResult.dispose();
    
    Point position = new Point(screenX, screenY);
    position = browser.getDisplay().map(null, browser, position);
    x = x;y = y;
    
    rgdispid = event.getIDsOfNames(new String[] { "ctrlKey" });
    dispIdMember = rgdispid[0];
    pVarResult = event.getProperty(dispIdMember);
    if (pVarResult.getBoolean()) {
      mask |= 0x40000;
    }
    pVarResult.dispose();
    
    rgdispid = event.getIDsOfNames(new String[] { "altKey" });
    dispIdMember = rgdispid[0];
    pVarResult = event.getProperty(dispIdMember);
    if (pVarResult.getBoolean()) {
      mask |= 0x10000;
    }
    pVarResult.dispose();
    
    rgdispid = event.getIDsOfNames(new String[] { "shiftKey" });
    dispIdMember = rgdispid[0];
    pVarResult = event.getProperty(dispIdMember);
    if (pVarResult.getBoolean()) {
      mask |= 0x20000;
    }
    pVarResult.dispose();
    
    stateMask = mask;
    
    rgdispid = event.getIDsOfNames(new String[] { "button" });
    dispIdMember = rgdispid[0];
    pVarResult = event.getProperty(dispIdMember);
    int button = pVarResult.getInt();
    pVarResult.dispose();
    switch (button)
    {
    case 1: 
      button = 1; break;
    case 2: 
      button = 3; break;
    case 4: 
      button = 2;
    }
    if (eventType.equals("mousedown"))
    {
      type = 3;
      button = button;
      count = 1;
    }
    else
    {
      if ((eventType.equals("mouseup")) || (eventType.equals("dragend")))
      {
        type = 4;
        button = (button != 0 ? button : 1);
        count = 1;
      }
      switch (button)
      {
      case 1: 
        stateMask |= 0x80000; break;
      case 2: 
        stateMask |= 0x100000; break;
      case 3: 
        stateMask |= 0x200000; break;
      case 4: 
        stateMask |= 0x800000; break;
      case 5: 
        stateMask |= 0x2000000;
      default: 
        break;
        if (eventType.equals("mousewheel"))
        {
          type = 37;
          rgdispid = event.getIDsOfNames(new String[] { "wheelDelta" });
          dispIdMember = rgdispid[0];
          pVarResult = event.getProperty(dispIdMember);
          count = (pVarResult.getInt() / 120 * 3);
          pVarResult.dispose();
        }
        else if (eventType.equals("mousemove"))
        {
          if ((x == lastMouseMoveX) && (y == lastMouseMoveY)) {
            return;
          }
          type = 5;
          lastMouseMoveX = x;lastMouseMoveY = y;
        }
        else if (eventType.equals("mouseover"))
        {
          type = 6;
        }
        else if (eventType.equals("mouseout"))
        {
          type = 7;
        }
        else if (eventType.equals("dragstart"))
        {
          type = 29;
          button = 1;
          stateMask |= 0x80000;
        }
        break;
      }
    }
    event.dispose();
    browser.notifyListeners(type, newEvent);
    if (eventType.equals("dblclick"))
    {
      newEvent = new Event();
      widget = browser;
      type = 8;
      x = x;y = y;
      stateMask = mask;
      type = 8;
      button = 1;
      count = 2;
      browser.notifyListeners(type, newEvent);
    }
  }
  
  void hookDOMListeners(OleAutomation webBrowser, boolean isTop)
  {
    int[] rgdispid = webBrowser.getIDsOfNames(new String[] { "Document" });
    int dispIdMember = rgdispid[0];
    Variant pVarResult = webBrowser.getProperty(dispIdMember);
    if (pVarResult == null) {
      return;
    }
    if (pVarResult.getType() == 0)
    {
      pVarResult.dispose();
      return;
    }
    OleAutomation document = pVarResult.getAutomation();
    pVarResult.dispose();
    
    unhookDOMListeners(new OleAutomation[] { document });
    
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", 64934, domListener);
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", 64933, domListener);
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", 64932, domListener);
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", 64931, domListener);
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", 64929, domListener);
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", 1033, domListener);
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", 64935, domListener);
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", 64930, domListener);
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", -2147418101, domListener);
    site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", -2147418091, domListener);
    if (isTop)
    {
      site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA00BDCE0B}", -2147418104, domListener);
      site.addEventListener(document, "{3050F613-98B5-11CF-BB82-00AA
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd