<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>83267</bug_id>
          
          <creation_ts>2012-04-05 04:48:02 -0700</creation_ts>
          <short_desc>Web Inspector: [JSC] &quot;SyntaxError: &apos;with&apos; statements are not valid in strict mode&quot; when debugging strict mode script</short_desc>
          <delta_ts>2013-03-21 15:03:53 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Inspector (Deprecated)</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>OS X 10.6</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>65829</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Matthew Caruana Galizia">matt.cg</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>apavlov</cc>
    
    <cc>bweinstein</cc>
    
    <cc>gavin</cc>
    
    <cc>joepeck</cc>
    
    <cc>keishi</cc>
    
    <cc>loislo</cc>
    
    <cc>mark.lam</cc>
    
    <cc>oliver</cc>
    
    <cc>o.smestad</cc>
    
    <cc>pfeldman</cc>
    
    <cc>pmuellr</cc>
    
    <cc>pom</cc>
    
    <cc>rik</cc>
    
    <cc>spam</cc>
    
    <cc>timothy</cc>
    
    <cc>yeecheng.chin+webkit</cc>
    
    <cc>yurys</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>596480</commentid>
    <comment_count>0</comment_count>
    <who name="Matthew Caruana Galizia">matt.cg</who>
    <bug_when>2012-04-05 04:48:02 -0700</bug_when>
    <thetext>Steps to reproduce:

1) Write a script with the &quot;strict mode&quot; flag at the top
2) Insert a breakpoint in your script and run something that will trigger a pause on that breakpoint
3) Open the console and attempt to evaluate something while execution is paused e.g. type &apos;this&apos; and hit enter

What should happen:

The entered script should be evaluated.

What happens instead:

A SyntaxError with the message &quot;&apos;with&apos; statements are not valid in strict mode&quot; is thrown.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>605004</commentid>
    <comment_count>1</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2012-04-18 12:55:07 -0700</bug_when>
    <thetext>&lt;rdar://problem/11271238&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>678161</commentid>
    <comment_count>2</comment_count>
    <who name="Gavin Kistner">gavin</who>
    <bug_when>2012-07-25 09:48:11 -0700</bug_when>
    <thetext>If there is a Radar bug for this, is it safe to say that the status is confirmed? This is a really bad problem, especially when attempting to debug new problems introduced specifically by Safari 6.0:
http://meta.stackoverflow.com/questions/134611/safari-is-asking-if-i-want-to-leave-the-page-when-saving-my-edits</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>742232</commentid>
    <comment_count>3</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2012-10-15 11:43:23 -0700</bug_when>
    <thetext>*** Bug 99305 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>742936</commentid>
    <comment_count>4</comment_count>
    <who name="Yury Semikhatsky">yurys</who>
    <bug_when>2012-10-16 01:18:55 -0700</bug_when>
    <thetext>Works fine in tip of tree Chromium and 23.0.1271.26 (Official Build 160934) beta.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>745121</commentid>
    <comment_count>5</comment_count>
    <who name="">yeecheng.chin+webkit</who>
    <bug_when>2012-10-18 03:18:13 -0700</bug_when>
    <thetext>Hi, is there a reason this bug is still unconfirmed, let alone fixed? It&apos;s a pretty simple, very easy to reproduce bug, and significantly discourages developers from developing strict mode code on Safari.

Basically in the inspector console, there&apos;s a hidden object &quot;window.console._commandLineAPI&quot; that provides some console functionality like &quot;$&quot;, &quot;clear&quot; etc. There&apos;s a function called evaluateOnCallFrame (defined in InjectedScriptSource.js) that the console tries to call to wrap whatever code it&apos;s calling in a with statement to wrap around the command line api object so those functions appear on the global scope. The with statement is obviously not legal in strict mode hence the exception.

I took at look at Chrome and couldn&apos;t figure out what they are doing differently but running code in console under strict mode does work, unlike Safari.

My suggestion is either:
1) Don&apos;t execute code under strict mode when in the inspector console. This is a one line fix in DebuggerCallFrame::evaluate. Basically instead of passing along the intended strict mode setting, just pass false to EvalExecutable::create. This is kind of a hack as the console won&apos;t be giving you the correct results (e.g. error when you try to call arguments.callee), but at least the console will work!
2) Find some better ways to wrap the command line API. I&apos;m not sure what Chrome does, but maybe we do can something like the following instead of using a with statement to wrap?
  (function() {
    var $ = window.console._commandLineAPI.$;
    var $$ = window.console._commandLineAPI.$$;
    var clear = window.console._commandLineAPI.clear;
    ...
    // The actual code the console is trying to run
    // This has an issue of masking out the global variables and other stack variables but there are ways to get around that
  )();

Either way I think it&apos;s better to get something working than the console being plain broken under strict mode!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>787193</commentid>
    <comment_count>6</comment_count>
    <who name="Øyvind Smestad">o.smestad</who>
    <bug_when>2012-12-10 04:24:51 -0800</bug_when>
    <thetext>This seems to be a duplicate of: https://bugs.webkit.org/show_bug.cgi?id=65829</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>793978</commentid>
    <comment_count>7</comment_count>
    <who name="JP Grace">spam</who>
    <bug_when>2012-12-18 13:16:19 -0800</bug_when>
    <thetext>How is this still not fixed?  It appears to be a duplicate of: https://bugs.webkit.org/show_bug.cgi?id=65829 that dates back to over a year ago.  I cannot debug anything in Safari as a result of this bug.  It&apos;s embarrassing.  Can we please prioritize this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>860759</commentid>
    <comment_count>8</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2013-03-21 15:03:53 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 65829 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>