Opened on 05/30/2016 at 10:55:15 AM

Closed on 10/23/2018 at 10:46:12 AM

#4086 closed defect (fixed)

JsValue.isNumber() crashes

Reported by: asmirnov Assignee: asmirnov
Priority: P3 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: rjeschke Blocked By: #4031
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29345353/

Description

JsValue.isNumber() throws UnsatisfiedLinkError.

Assume we have the following test case:

@Test
    public void testUndefinedValue() {
        final JsValue value = jsEngine.evaluate("undefined");
        assertTrue(value.isUndefined());
        assertFalse(value.isNull());
        assertFalse(value.isString());
        assertFalse(value.isBoolean());
        assertFalse(value.isNumber());
        assertFalse(value.isObject());
        assertFalse(value.isArray());
        assertEquals("undefined", value.asString());
        try {
            value.asList();
            fail(AdblockPlusException.class.getSimpleName() + " is expected to be thrown");
        } catch (AdblockPlusException e) {
            // ignored
        }
        try {
            value.getProperty("foo");
            fail(AdblockPlusException.class.getSimpleName() + " is expected to be thrown");
        } catch (AdblockPlusException e) {
            // ignored
        }
    }

then we will have an exception:

05-30 06:49:31.610    1909-1923/org.adblockplus.libadblockplus.tests I/TestRunner﹕ failed: testUndefinedValue(org.adblockplus.libadblockplus.tests.JsTest)
05-30 06:49:31.610    1909-1923/org.adblockplus.libadblockplus.tests I/TestRunner﹕ ----- begin exception -----
05-30 06:49:31.610    1909-1923/org.adblockplus.libadblockplus.tests I/TestRunner﹕ java.lang.UnsatisfiedLinkError: Native method not found: org.adblockplus.libadblockplus.JsValue.isNumber:(J)Z
            at org.adblockplus.libadblockplus.JsValue.isNumber(Native Method)
            at org.adblockplus.libadblockplus.JsValue.isNumber(JsValue.java:62)
            at org.adblockplus.libadblockplus.tests.JsTest.testUndefinedValue(JsTest.java:37)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at junit.framework.TestCase.runTest(TestCase.java:168)
            at junit.framework.TestCase.runBare(TestCase.java:134)
            at junit.framework.TestResult$1.protect(TestResult.java:115)
            at junit.framework.TestResult.runProtected(TestResult.java:133)
            at junit.framework.TestResult.run(TestResult.java:118)
            at junit.framework.TestCase.run(TestCase.java:124)
            at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
            at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
            at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
            at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
05-30 06:49:31.610    1909-1923/org.adblockplus.libadblockplus.tests I/TestRunner﹕ ----- end exception -----
05-30 06:49:31.610    1909-1923/org.adblockplus.libadblockplus.tests I/TestRunner﹕ finished: testUndefinedValue(org.adblockplus.libadblockplus.tests.JsTest)
05-30 06:49:31.610    1899-1899/? D/AndroidRuntime﹕ Shutting down VM

it seems that the method is just not registered:
https://hg.adblockplus.org/adblockplusandroid/file/tip/jni/JniJsValue.cpp#l191

Attachments (0)

Change History (5)

comment:1 Changed on 05/30/2016 at 11:09:14 AM by asmirnov

  • Platform changed from Unknown / Cross platform to Android

comment:2 Changed on 05/30/2016 at 11:23:14 AM by asmirnov

  • Owner changed from Anton to asmirnov

comment:3 Changed on 06/02/2016 at 12:51:52 PM by abpbot

A commit referencing this issue has landed:
Issue 4086 - JsValue.isNumber() crashes

comment:4 Changed on 06/10/2016 at 10:51:37 AM by asmirnov

  • Review URL(s) modified (diff)

comment:5 Changed on 10/23/2018 at 10:46:12 AM by asmirnov

  • Resolution set to fixed
  • Status changed from new to closed

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from asmirnov.
 
Note: See TracTickets for help on using tickets.