Project

General

Profile

Feature #12056

Microsoft WebBrowser ActiveX control: script execution and document access

Added by Greg Shah about 1 month ago. Updated 8 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

billable:
No
vendor_id:
GCD
case_num:
version_reported:
version_resolved:
reviewer:
production:
No
env_name:
topics:

History

#1 Updated by Greg Shah about 1 month ago

Microsoft WebBrowser ActiveX control: script execution and document access

Project: User Interface

Problem

The Microsoft WebBrowser control (Shell.Explorer, CLSID {8856F961-340A-11D0-A96B-00C04FD705A2}) is used to embed maps, a hosted login page and chart panes. Members used: Navigate, Document:parentWindow:execScript (two-way JavaScript calls), Document:Script:<name> to read values back from the hosted page, ExecWB to print, and position and size. Events: TitleChange and DocumentComplete.

FWD's HTML-BROWSER renders a live iframe with navigation, loading from a string, printing, a postMessage bridge and navigation events. It has no execScript and no access to the page from the server.

Work

  1. Map the control onto HTML-BROWSER with an alias table.
  2. Add a script execution bridge for execScript and for reading script values from the page, over the postMessage bridge, with a completion event so that the 4GL can wait for the result.
  3. Map ExecWB printing, TitleChange and DocumentComplete.
  4. Register the control's CLSID in the OCX registry (ocx-registry.xml), mapping it to the target widget, as #11919 did for ctToolBar.
  5. Decode the design-time state the control keeps in the .wrx storage at conversion time, so that it exists after conversion.
  6. Implement the members and events listed above on the target, with the vendor's semantics: argument types, return values, defaults, and the order in which events fire. Members of the type library that are not used become no-ops with a conversion warning, as the OCX pipeline already does.
  7. Follow the OCX emulation playbook attached to #11919: an OpenEdge test program with goldens for each member and event, recorded input sequences for the interactive parts, and Lyra automation.
  8. Update the gap marking and the OCX registry documentation.

Testcases

Each member and event above, exercised on Windows OpenEdge with the real control to produce goldens, then run against the FWD replacement on the web and Swing clients. The vendor help files are the reference where behaviour cannot be observed directly.

#2 Updated by Greg Shah 8 days ago

The same project also uses the .NET Windows Forms browser class, System.Windows.Forms.WebBrowser, from 4GL. It is never shown in a form: it loads a local HTML file, waits for it, and prints it, or shows the page setup dialog:

oBrowser = NEW System.Windows.Forms.WebBrowser().
oBrowser:DocumentCompleted:Subscribe("onDocumentCompleted").
oBrowser:Url = NEW System.Uri(cHtmlFile).
...
PROCEDURE onDocumentCompleted:
   DEFINE INPUT PARAMETER sender AS System.Object NO-UNDO.
   DEFINE INPUT PARAMETER e      AS System.EventArgs NO-UNDO.
   oBrowser:Print().
END PROCEDURE.

The members used are the constructor, Url (set, through System.Uri), the DocumentCompleted event, Print() and ShowPageSetupDialog(). All of them are the work this task already does for the ActiveX control, so it should cover this class too:

  1. Map System.Windows.Forms.WebBrowser onto the same HTML-BROWSER support in the conversion, with System.Uri(character) accepted as the URL, and System.Object and System.EventArgs accepted as the event handler's parameter types.
  2. Raise DocumentCompleted from the same document-completion event as the ActiveX control's DocumentComplete.
  3. Print() prints the loaded page the same way as the ActiveX control's ExecWB print: the user prints it from their browser.
  4. ShowPageSetupDialog() and page setup in general: there are no Internet Explorer registry settings in a converted system. Use FWD's own print options (page size, orientation and margins, as PDFPageSetup already models), and let ShowPageSetupDialog() edit them for the session.
  5. Allow the browser object to exist without being shown, since this code never places it on a frame.

Testcases: load a local HTML file through Url, receive DocumentCompleted and call Print(); ShowPageSetupDialog() followed by Print(), checking that the chosen page settings apply; the same flow with a missing file.

Also available in: Atom PDF