Ignore:
Timestamp:
Jan 27, 2014, 11:29:57 PM (12 years ago)
Author:
Joseph Pecoraro
Message:

-[JSContext evaluteScript:] calls JSEvaluteScript with startingLineNumber 0, later interpreted as a oneBasedInt
https://bugs.webkit.org/show_bug.cgi?id=127648

Reviewed by Geoffrey Garen.

The actual bug being fixed here is that the line number for
scripts evaluated via the JSC APIs is now sane. However,
there is no good infrastructure in place right now to test that.

  • API/tests/testapi.c:

(main):

  • API/tests/testapi.mm:

(testObjectiveCAPI):
Add tests for exception line numbers and handling of bad
startingLineNumbers in public APIs. These tests were already
passing, I just add them to make sure they are not regressed
in the future.

  • API/JSBase.cpp:

(JSEvaluateScript):
(JSCheckScriptSyntax):

  • API/JSBase.h:
  • API/JSObjectRef.cpp:

(JSObjectMakeFunction):

  • API/JSObjectRef.h:
  • API/JSScriptRef.cpp:
  • API/JSScriptRefPrivate.h:
  • API/JSStringRef.h:
  • Clarify documentation that startingLineNumber is 1 based and clamped.
  • Add clamping in the implementation to put sane values into JSC::SourceProvider.
  • inspector/agents/InspectorDebuggerAgent.cpp:

(Inspector::InspectorDebuggerAgent::didParseSource):
Remove the FIXME now that the SourceProvider is giving us expected values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSObjectRef.cpp

    r161220 r162918  
    2222 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    2323 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    24  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2525 */
    2626
     
    136136    APIEntryShim entryShim(exec);
    137137
     138    startingLineNumber = std::max(1, startingLineNumber);
    138139    Identifier nameID = name ? name->identifier(&exec->vm()) : Identifier(exec, "anonymous");
    139140   
Note: See TracChangeset for help on using the changeset viewer.