Bug 514859 [Webkit2] Verify that no webkit1-only functions are called on
Webkit2.

As part of the webkit2 port, we must ensure that no webkit1 functions
are ever called by webkit2.

To ensure this, I've added assertions around native function calls.
During the patch, I discovered multiple webkit1 only functions that
were reached by webkit2. (Will post into bug).

This patch has no real functional impact, only asserts, comments and
some refactoring.
Note: assertions are not executed normally, only by jUnits and if '-ea'
is specified in vm args.

Technical notes:
- I moved the "WEBKIT2" variable and the logic that loads the native
  libraries from WebKit.java to WebKitGTK.java, so that the native
  function wrappers can access the WEBKIT2 variable.
  I ensured that classes are loaded in proper order.

- I added a WEBKIT1 flag for clarity.
  The negation !WEBKIT2 slows down code reading, it's very annoying.
  I also carefully ensured that there is no functional difference.

- I added asserts around every webkit(1|2) function call.
  (I did this with some help of programmatically checking if a function
  is webkit1 or only webkit2).

- Found some Webkit1 only functions being called on Webkit2
  (see bug for details. See "TODO - guard from being called on webkit2"
  inline comments in patch).

- Sprinkled some more asserts into WebKit.java and added comments.

- Guarded a few Webkit1 only functions from being reached by webkit2
  and added some TODO's into that code.

- Found that my SWT_LIB_VERSIONS logic was calling a webkit2 only
  function when webkit2 was called. Fixed that up.

- I changed org.eclipse.jdt.ui.prefs a bit so that it it doesn't turn
  static imports into "*" for WEBKIT1 and WEBKIT2 flag.
  (WEBKIT1 and WEBKIT2 flag is imported statically in WebKit.java,
  for sake of brevity).

Testing
- Junits for Webkit1 & Webkit2
- Child eclipse with webkit1 & webkit2

Change-Id: Ic63503e68e73974a0ca2c7716faabe5039df5ccb
Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
4 files changed
tree: 6383ced899e08283dc87aca95184f415f31f62d2
  1. bundles/
  2. examples/
  3. features/
  4. local-build/
  5. tests/
  6. .gitignore
  7. pom.xml
  8. README.md
README.md

Contributing to SWT

Thanks for your interest in this project.

Developer resources:

See the following description for how to contribute a feature or a bug fix to SWT.

Information regarding source code management, builds, coding standards, and more and be found under the following link.

Contributor License Agreement:

Before your contribution can be accepted by the project, you need to create and electronically sign the Eclipse Foundation Contributor License Agreement (CLA).

Contact:

Contact the project developers via the project's “dev” list.

Search for bugs:

This project uses Bugzilla to track ongoing development and issues.

Create a new bug:

Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!