sketch-devtools icon indicating copy to clipboard operation
sketch-devtools copied to clipboard

print/log methods are not being vandalized correctly in a rare case

Open turbobabr opened this issue 10 years ago • 8 comments

Bug report from German Bauer:


Andrey, to be more precise here is what happens:

  • I add your plugin folder with the great dev tools
  • I go back to sketch and see the newly added console commands under plugins > your folder
  • I bring up your dev console
  • The above described bug shows up, not with my plugin, but with your 3 line sample code
  • The above described bug shows up, even with just one "print(sketch)" line in the custom plugin field from your sample code
  • I remove all other plugins from the plugins folder, same bug
  • I remove your plugin from plugins folder it all starts working again as expected

The screenshot:


image

turbobabr avatar Oct 27 '14 02:10 turbobabr

Experiment 1:


Run the following code using custom script editor:

SketchConsole.extendedPrint_info_sourceScript(sketch,{ 
    line: 1 
},coscript.printController().processedScript());

I need to know if it produces any output into DevTools console. Also it would be nice to have a screenshot of the result.

turbobabr avatar Oct 27 '14 02:10 turbobabr

Experiment 2:


  1. Launch system Console App (/Applications/Utilities/Console.app)
  2. Add new system log query using File -> New System Log Query... bitmap
  3. In the query set sender contains sketch: bitmap
  4. Select the newly created query: bitmap
  5. Clear console.
  6. Run only once the following script in the custom script editor:
print(sketch);

Finally - publish console output in the comment.

turbobabr avatar Oct 27 '14 02:10 turbobabr

Questions:


  1. Did you compile the SketchConsole.framework yourself or just downloded the Sketch DevTools.zip archive and extracted it into Plugins folder?
  2. Do you use Sketch from AppStore or it is non-sandboxed version that was downloaded from BC site and bought using third-party merchant store?
  3. What version of Sketch do you use?
  4. What OSX version do you use?

turbobabr avatar Oct 27 '14 02:10 turbobabr

Experiment 3:


  1. Clear system console output.
  2. Run the following code in the custom script editor:
coscript.print(print);
coscript.print(log);

Copy and paste output as a comment here.

turbobabr avatar Oct 27 '14 02:10 turbobabr

Could this somehow be related to zmalltalker/sketch-android-assets#22 ?

zmalltalker avatar Nov 04 '14 11:11 zmalltalker

Oh yeah! It's definitely related. Thanks for reporting it. I'm trying to track this bug since the first release day, but can't replicate it. Will ask mmrocks to participate.

turbobabr avatar Nov 05 '14 04:11 turbobabr

Hi - I installed devtools and ran into the same problem. I'll try to answer the questions: Experiment 1- This appears in the console: { doc = "<MSDocument: 0x6000003ed200>"; scriptPath = "/Users/woody/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins/Untitled.sketchplugin"; scriptURL = "file:///Users/woody/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application%20Support/com.bohemiancoding.sketch3/Plugins/Untitled.sketchplugin"; selection = ( ); }

Experiment 2: in the system console I get: 1/16/15 2:01:28.875 PM Untitled (Sketch Plugin)[26438]: TypeError: 'undefined' is not a function (evaluating 'print(sketch)'). Plugin “Untitled”, line 1. » print(sketch); « 1/16/15 2:01:28.875 PM Sketch[26438]: Exception: { line = 1; sourceURL = "/Users/woody/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins/Untitled.sketchplugin"; stack = "global code@/Users/woody/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins/Untitled.sketchplugin:1:6"; }

Experiment 3- In the system console I get: 1/16/15 2:06:34.097 PM Untitled (Sketch Plugin)[26438]: <MOUndefined: 0x60000001b170> 1/16/15 2:06:34.097 PM Untitled (Sketch Plugin)[26438]: <MOUndefined: 0x60000001b170>

I'm using OSX 10.9.5, Sketch 3.2.2 ( from the App Store, so sandboxed),and I downloaded the zip and extracted it into the plugins folder.

Hope this helps

woodyaurnh avatar Jan 16 '15 19:01 woodyaurnh

I ran into this bug too. Here's the info:

System:

  • OSX 10.9.5
  • Sketch 3.3 from the App Store
  • Sketch DevTools master downloaded and copied to plugin directory

Experiment 1:

ReferenceError: Can't find variable: sketch stack: onRun@/Users/dproct01/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins/Untitled.sketchplugin:2:55 line: 2 sourceURL: /Users/dproct01/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins/Untitled.sketchplugin


Experiment 2:

23/04/2015 14:07:37.356 Sketch[13966]: Exception: ReferenceError: Can't find variable: sketch 23/04/2015 14:07:37.356 untitled script (Sketch Plugin)[13966]: ReferenceError: Can't find variable: sketch stack: onRun@/Users/dproct01/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins/Untitled.sketchplugin:2:15 line: 2 sourceURL: /Users/dproct01/Library/Containers/com.bohemiancoding.sketch3/Data/Library/Application Support/com.bohemiancoding.sketch3/Plugins/Untitled.sketchplugin


Experiment 3:

23/04/2015 14:08:21.400 untitled script (Sketch Plugin)[13966]: <MOUndefined: 0x618000006930> 23/04/2015 14:08:21.400 untitled script (Sketch Plugin)[13966]: <MOUndefined: 0x618000006930>

doug-proctor avatar Apr 23 '15 13:04 doug-proctor