ripple-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Horn, Julian C" <julian.c.h...@intel.com>
Subject RE: Ripple is trying to exec native ios plugins! Why?
Date Fri, 14 Nov 2014 14:43:44 GMT
Hi Jeremy,

Ripple is not trying to run native code.  The short answer to your question is 
1) You have hit a bug in Ripple
2) Your best work-around is to remove the console plugin from your project.  You can do this
with this command:
    cordova plugin rm org.apache.cordova.console

Since you're probably curious I will try to explain what's really going on here in a bit more
detail.

Cordova plugins consist of a (mostly) platform-independent JavaScript layer that delegates
to native code via a bridging function called "exec".  Since Ripple isn't an instruction-level
emulator, it can't actually execute the native code implementation.  So Ripple replaces the
exec function with something that invokes an emulation of the native layer that is supplied
by Ripple.

If you look at your traceback, you will see that an onError handler in your code, js/baseUtils.js,
was invoked.  This called console.error.  When cordova.js installed the console plugin, it
replaced the browser's implementation of console with the plugin.  So it's not surprising
that this call lands you in plugins/org.apache.cordova.console/www/console-via-logger.js.
 That's the plugin's JavaScript code, and Ripple is correct to execute it.

Before I go further, let me point out that you would be perfectly fine if you had gone directly
to the browser's implementation of console.  This is what would happen if you weren't using
the console plugin.  The console plugin diverts console messages to someplace more convenient,
such as the XCode output window.  When you're running in Ripple, you want the console messages
from your app to show up in the browser's console.  There isn't any place better for them
to go.

Returning to your traceback, you eventually reach a call to exec on line 333 in plugins/org.apache.cordova.console/www/logger.js.
 That call looks like this:
    exec(null, null, "Console", "logLevel", [level, message]);

Now you cross over into Ripple's exec function.  It finds the object that implements the "Console"
service and tries to invoke the emulation of the "logLevel" function.  This failed because
that object didn't have any logLevel property.  That's a Ripple bug.

    Julian

-----Original Message-----
From: Jeremy Colton [mailto:jscolton@gmail.com] 
Sent: Thursday, November 13, 2014 12:21 PM
To: dev@ripple.incubator.apache.org
Subject: Ripple is trying to exec native ios plugins! Why?

Hi,

I am running my PhoneGap 3.6.3 project inside of Ripple 0.9.24.

The cordova.s parses my cordova_plugins.js, runs each plugin's .js which then tries to call
the Objective C related counterpart which obviously does not exist since the code is running
in Ripple in Chrome.

So I see lots of error message in the console, eg:

missing exec:Console.logLevel
TypeError: Cannot read property 'logLevel' of undefined
    at ripple.define.module.exports.exec (
http://localhost:4400/ripple/assets/ripple.js:40:28665)
    at Object.logger.logLevel (
http://localhost:4400/plugins/org.apache.cordova.console/www/logger.js:233:9
)
    at logWithArgs (
http://localhost:4400/plugins/org.apache.cordova.console/www/logger.js:195:21
)
    at Object.logger.error (
http://localhost:4400/plugins/org.apache.cordova.console/www/logger.js:166:36
)
    at Object.console.error (
http://localhost:4400/plugins/org.apache.cordova.console/www/console-via-logger.js:76:18
)
    at Object.error (
http://localhost:4400/plugins/org.apache.cordova.console/www/console-via-logger.js:174:23
)
    at window.onerror (http://localhost:4400/js/baseUtils.js:258:11)

So, is this expected behaviour or is there a way to tell Ripple NOT to run native plugins?

Cheers
Jeremy
Mime
View raw message