// Error checking.
if (icon.IsEmpty()) {
+ args->ThrowError("Must specify 'icon' option");
+ return;
+ }
+
+#if defined(OS_MACOSX)
+ // NSWindow.dragImage requires a non-empty NSImage
+ if (icon->image().IsEmpty()) {
args->ThrowError("Must specify non-empty 'icon' option");
return;
}
+#endif
// Start dragging.
if (!files.empty()) {
}, /Must specify either 'file' or 'files' option/)
assert.throws(() => {
- w.webContents.startDrag({file: __filename, icon: __filename})
- }, /Must specify non-empty 'icon' option/)
-
- assert.throws(() => {
w.webContents.startDrag({file: __filename})
- }, /Must specify non-empty 'icon' option/)
+ }, /Must specify 'icon' option/)
+
+ if (process.platform === 'darwin') {
+ assert.throws(() => {
+ w.webContents.startDrag({file: __filename, icon: __filename})
+ }, /Must specify non-empty 'icon' option/)
+ }
})
})
})