~ubuntu-branches/ubuntu/raring/icedtea-web/raring

« back to all changes in this revision

Viewing changes to plugin/icedteanp/IcedTeaPluginRequestProcessor.cc

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-02-04 18:19:46 UTC
  • mfrom: (1.1.16)
  • Revision ID: package-import@ubuntu.com-20120204181946-jngobgzz4mlen9yl
Tags: 1.2~pre1-0ubuntu1
* Update to hg 20120203, taken from the icedtea-web-1.2 release branch.
* Build separate plugin packages for OpenJDK 6 and OpenJDK 7, needed
  to provide the path to the runtime and the mime description in the plugin.
* Use icedtea-<jre version>-plugin as the name for both plugin packages.
* Remove icedtea-web-1.1.4-npapi-fix.patch, fixed upstream.
* Pass -n to gzip when compressing manpages to be Multi-Arch: same safe.
* Build multiarch packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
243
243
 
244
244
    NPVariant* result_variant = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(thread_data.result);
245
245
    std::string result_variant_jniid = std::string();
246
 
    createJavaObjectFromVariant(instance, *result_variant, &result_variant_jniid);
 
246
    if (result_variant)
 
247
    {
 
248
        createJavaObjectFromVariant(instance, *result_variant, &result_variant_jniid);
 
249
    } else
 
250
    {
 
251
        result_variant_jniid = "0";
 
252
    }
247
253
 
248
254
    IcedTeaPluginUtilities::constructMessagePrefix(0, reference, &response);
249
255
    response += " JavaScriptEval ";
477
483
 * This is a static function, called in another thread. Since certain data
478
484
 * can only be requested from the main thread in Mozilla, this function
479
485
 * does whatever it can seperately, and then makes an internal request that
480
 
 * causes _sendMember to do the rest of the work.
 
486
 * causes _getMember to do the rest of the work.
481
487
 *
482
488
 * @param message_parts The request message
483
489
 */
490
496
    JavaRequestProcessor java_request = JavaRequestProcessor();
491
497
    JavaResultData* java_result;
492
498
    NPVariant* parent_ptr;
 
499
    NPVariant* member_ptr;
493
500
 
494
501
    //int reference;
495
502
    std::string member_id = std::string();
496
 
    std::string jsObjectClassID = std::string();
497
 
    std::string jsObjectConstructorID = std::string();
498
503
    std::string response = std::string();
 
504
    std::string result_id = std::string();
499
505
 
500
506
    NPIdentifier member_identifier;
501
507
 
551
557
 
552
558
    PLUGIN_DEBUG("Member PTR after internal request: %s\n", thread_data.result.c_str());
553
559
 
554
 
    java_result = java_request.findClass(0, "netscape.javascript.JSObject");
555
 
 
556
 
    // the result we want is in result_string (assuming there was no error)
557
 
    if (java_result->error_occurred)
558
 
    {
559
 
        printf("Unable to process getMember request. Error occurred: %s\n", java_result->error_msg->c_str());
560
 
        //goto cleanup;
561
 
    }
562
 
 
563
 
    jsObjectClassID.append(*(java_result->return_string));
564
 
 
565
 
    args = std::vector<std::string>();
566
 
    std::string longArg = "J";
567
 
    args.push_back(longArg);
568
 
 
569
 
    java_result = java_request.getMethodID(jsObjectClassID,
570
 
                                           browser_functions.getstringidentifier("<init>"),
571
 
                                           args);
572
 
 
573
 
    // the result we want is in result_string (assuming there was no error)
574
 
    if (java_result->error_occurred)
575
 
    {
576
 
        printf("Unable to process getMember request. Error occurred: %s\n", java_result->error_msg->c_str());
577
 
        //goto cleanup;
578
 
    }
579
 
 
580
 
    jsObjectConstructorID.append(*(java_result->return_string));
581
 
 
582
 
    // We have the method id. Now create a new object.
583
 
 
584
 
    args.clear();
585
 
    args.push_back(thread_data.result);
586
 
    java_result = java_request.newObjectWithConstructor("",
587
 
                                         jsObjectClassID,
588
 
                                         jsObjectConstructorID,
589
 
                                         args);
590
 
 
591
 
    // the result we want is in result_string (assuming there was no error)
592
 
    if (java_result->error_occurred)
593
 
    {
594
 
        printf("Unable to process getMember request. Error occurred: %s\n", java_result->error_msg->c_str());
595
 
        //goto cleanup;
596
 
    }
597
 
 
 
560
    member_ptr = (NPVariant*) IcedTeaPluginUtilities::stringToJSID(thread_data.result);
 
561
 
 
562
    createJavaObjectFromVariant(instance, *member_ptr, &result_id);
598
563
 
599
564
    IcedTeaPluginUtilities::constructMessagePrefix(0, reference, &response);
600
 
    if (*(message_parts->at(2)) == "GetSlot")
 
565
    if (*(message_parts->at(4)) == "GetSlot")
601
566
    {
 
567
        response.append(" JavaScriptGetSlot ");
 
568
    } else {
602
569
        response.append(" JavaScriptGetMember ");
603
 
    } else {
604
 
        response.append(" JavaScriptGetSlot ");
605
570
    }
606
 
    response.append(java_result->return_string->c_str());
 
571
    response.append(result_id.c_str());
607
572
    plugin_to_java_bus->post(response.c_str());
608
573
}
609
574