JDK-8167098 : Backport of JDK-8158926 to JDK 8u mistakenly used preliminary patch
  • Type: Bug
  • Component: javafx
  • Sub-Component: web
  • Affected Version: 8u112
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-10-04
  • Updated: 2018-03-02
  • Resolved: 2016-10-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8
8u131Fixed
Related Reports
Blocks :  
Cloners :  
Relates :  
Relates :  
Description
This was discovered while auditing the diffs in the native WebKit code between FX 9-dev and 8u-dev. Except for JDK-9-specific build changes there should be no differences, but there are.

This difference is:

diff -u -r 9-dev/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp 8u-dev/rt/modules/web/src/main/native/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
--- 9-dev/rt/modules/javafx.web/src/main/native/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp	2016-08-22 07:59:20.751842615 -0700
+++ 8u-dev/rt/modules/web/src/main/native/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp	2016-08-30 11:18:58.751621961 -0700
@@ -84,8 +84,8 @@
 Class* JavaInstance::getClass() const
 {
     if (!m_class) {
-        jobject acc = accessControlContext();
-        m_class = new JavaClass(m_instance->instance(), rootObject(), acc);
+        jobject acc  = accessControlContext();
+        m_class = new JavaClass (m_instance->instance(), rootObject(), acc);
     }
     return m_class;
 }
@@ -168,6 +168,10 @@
     }
 
     JavaClass* aClass = static_cast<JavaClass*>(getClass());
+
+    if (!aClass)
+        return jsUndefined();
+
     if (aClass->isCharacterClass())
         return numberValueForCharacter(obj);
     if (aClass->isBooleanClass())
@@ -232,6 +236,10 @@
 JSValue JavaInstance::getMethod(ExecState* exec, PropertyName propertyName)
 {
     JavaClass* aClass = static_cast<JavaClass*>(getClass());
+
+    if (!aClass)
+        return jsUndefined();
+
     Method *method = aClass->methodNamed(propertyName, this);
     return JavaRuntimeMethod::create(exec, exec->lexicalGlobalObject(), propertyName.publicName(), method);
 }
@@ -274,7 +282,7 @@
     // to handle valueOf method call.
     jobject obj = m_instance->instance();
     JavaClass* aClass = static_cast<JavaClass*>(getClass());
-    if (aClass->isCharacterClass() && jMethod->name() == "valueOf")
+    if (aClass && aClass->isCharacterClass() && jMethod->name() == "valueOf")
         return numberValueForCharacter(obj);
 
     // Since m_instance->instance() is WeakGlobalRef, creating a localref to safeguard instance() from GC
@@ -423,6 +431,9 @@
         return numberValue(exec);
 
     JavaClass* aClass = static_cast<JavaClass*>(getClass());
+    if (!aClass)
+        return jsUndefined();
+
     if (aClass->isStringClass())
         return stringValue(exec);
 

Comments
changeset: 7564106edf0e tag: tip user: arajkumar date: Fri Oct 07 22:12:21 2016 +0530 files: modules/web/src/main/native/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp description: 8167098: Backport of JDK-8158926 to JDK 8u mistakenly used preliminary patch Reviewed-by: ghb, mbilla URL: http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/7564106edf0e
07-10-2016

The above changeset needs to be backed out and re-pushed to fix a problem with an unintended file committed as part of the changeset. See JDK-8167351.
07-10-2016

+1
07-10-2016

+1
07-10-2016

http://cr.openjdk.java.net/~arajkumar/8167098/webrev.00
07-10-2016

changeset: 43a27ac2fd89 user: arajkumar date: Fri Oct 07 11:50:14 2016 +0530 files: modules/web/src/main/native/Source/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp modules/web/src/main/native/Source/cmake/OptionsCommon.cmake description: Reviewed-by: ghb, kcr URL: http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/43a27ac2fd89
07-10-2016

@Kevin, Mistakenly I have back ported webrev.01 instead of webrev.02 for JDK-8158926. So the change should be made in other way, files in question should be moved from 9-dev to 8u-dev.
06-10-2016

Oh, I see. I just went back and reread Murali's comments indicating that the removed null checks for aclass are OK. In that case, since the 9 changeset is correct, I reworded the bug title to reflect this and updated the affected version, the fix version, and the labels. Please provide a new webrev for 8u-dev to remedy this. Thanks.
06-10-2016

I think the best fix is likely to copy the file in question from 8u-dev to 9-dev and generate a webrev from that. Note that the generated patch should look like the diffs in the description.
04-10-2016

Bisecting the repo shows this: The first bad revision is: changeset: 9863:439e19883bc5 user: arajkumar date: Fri Jun 24 07:03:37 2016 +0100 summary: 8158926: Char value is set as integer, not as character In looking at the webrev and changeset for JDK-8158926 the problem was there in the webrev and we all missed seeing it.
04-10-2016