Closed Bug 1315122 Opened 8 years ago Closed 8 years ago

JS::Heap::isSetToCrashOnTouch() unusable

Categories

(Core :: JavaScript Engine, defect)

31 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: ptomato, Assigned: jonco)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36

Steps to reproduce:

Here's a code snippet that seems like it should work:

auto heap_wrapper = new JS::Heap<JSObject *>();
heap_wrapper->setToCrashOnTouch();
if (heap_wrapper->isSetToCrashOnTouch())
    printf("Indeed, set to crash on touch!\n");


Actual results:

Here's the compiler output from g++ 4.9.2:

In file included from /usr/local/include/mozjs-31/js/CallArgs.h:38:0,
                 from /usr/local/include/mozjs-31/jsapi.h:24,
                 from jssample.cpp:1:
/usr/local/include/mozjs-31/js/RootingAPI.h: In instantiation of ‘bool JS::Heap<T>::isSetToCrashOnTouch() [with T = JSObject*]’:
jssample.cpp:48:47:   required from here
/usr/local/include/mozjs-31/js/RootingAPI.h:257:20: error: no match for ‘operator==’ (operand types are ‘JSObject*’ and ‘JS::Heap<JSObject*>::<anonymous enum>’)
         return ptr == crashOnTouchPointer;



Expected results:

It looks like the template of isSetToCrashOnTouch() is missing a cast, it should probably have the same cast as setToCrashOnTouch() a few lines above it.

Note, I am testing this with ESR 31, but this code is still present in the latest ESR.
This API is broken, but it's also unused.  Here's a patch to remove it.
Assignee: nobody → jcoppeard
Attachment #8807515 - Flags: review?(jdemooij)
Attachment #8807515 - Flags: review?(jdemooij) → review+
Pushed by jcoppeard@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/24ed6f84d823
Remove JS::Heap<T>'s unused setToCrashOnTouch() methods r=jandem
https://hg.mozilla.org/mozilla-central/rev/24ed6f84d823
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: