Upstream version 5.34.98.0 59/17759/1 submit/tizen/20140310.124425
authorEurogiciel-BOT <eurogiciel.tizen@gmail.com>
Mon, 10 Mar 2014 10:33:56 +0000 (10:33 +0000)
committerEurogiciel-BOT <eurogiciel.tizen@gmail.com>
Mon, 10 Mar 2014 10:33:56 +0000 (10:33 +0000)
Upstream commit-id fc2b4989ec65db460a28092c455c494075aae385

Change-Id: I21dcc870d1335af3392f5b7aa71ec8dcb4bcbf45
Signed-off-by: Eurogiciel-BOT <eurogiciel.tizen@gmail.com>
29 files changed:
packaging/crosswalk.spec
packaging/xwalk [deleted file]
packaging/xwalk.in [new file with mode: 0755]
packaging/xwalk.service [deleted file]
packaging/xwalk.service.in [new file with mode: 0644]
src/xwalk/VERSION
src/xwalk/app/tools/android/make_apk.py
src/xwalk/app/tools/android/make_apk_test.py
src/xwalk/application/browser/application_protocols.cc
src/xwalk/application/browser/application_protocols.h
src/xwalk/extensions/browser/xwalk_extension_service.cc
src/xwalk/extensions/common/xwalk_extension_server.h
src/xwalk/packaging/crosswalk.spec
src/xwalk/packaging/xwalk [deleted file]
src/xwalk/packaging/xwalk.in [new file with mode: 0755]
src/xwalk/packaging/xwalk.service [deleted file]
src/xwalk/packaging/xwalk.service.in [new file with mode: 0644]
src/xwalk/runtime/android/core/src/org/xwalk/core/XWalkInternalResources.java
src/xwalk/runtime/browser/android/intercepted_request_data_impl.cc
src/xwalk/runtime/browser/android/net/android_protocol_handler.cc
src/xwalk/runtime/browser/android/net/android_stream_reader_url_request_job.cc
src/xwalk/runtime/browser/android/net/android_stream_reader_url_request_job.h
src/xwalk/runtime/browser/android/xwalk_content.cc
src/xwalk/runtime/browser/xwalk_browser_main_parts.cc
src/xwalk/runtime/browser/xwalk_browser_main_parts.h
src/xwalk/runtime/browser/xwalk_browser_main_parts_android.cc
src/xwalk/test/android/core/javatests/src/org/xwalk/core/xwview/test/XWalkClientShouldInterceptRequestTest.java
src/xwalk/test/android/runtime_client/javatests/src/org/xwalk/runtime/client/test/CSPTest.java
src/xwalk/test/android/runtime_client_embedded/javatests/src/org/xwalk/runtime/client/embedded/test/CSPTest.java

index 146cb99..331bad2 100644 (file)
@@ -2,16 +2,16 @@
 %bcond_with wayland
 
 Name:           crosswalk
-Version:        5.34.97.0
+Version:        5.34.98.0
 Release:        0
 Summary:        Crosswalk is an app runtime based on Chromium
 License:        (BSD-3-Clause and LGPL-2.1+)
 Group:          Web Framework/Web Run Time
 Url:            https://github.com/otcshare/crosswalk
 Source:         %{name}.tar
-Source1:        xwalk
+Source1:        xwalk.in
 Source2:        org.crosswalkproject.Runtime1.service
-Source3:        xwalk.service
+Source3:        xwalk.service.in
 Source1001:     crosswalk.manifest
 Source1002:     %{name}.xml.in
 Source1003:     %{name}.png
@@ -100,10 +100,14 @@ This package contains additional support files that are needed for running Cross
 %prep
 %setup -q -n crosswalk
 
+cp %{SOURCE1} .
+cp %{SOURCE3} .
 cp %{SOURCE1001} .
 cp %{SOURCE1002} .
 cp %{SOURCE1003} .
 sed "s/@VERSION@/%{version}/g" %{name}.xml.in > %{name}.xml
+sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk.in > xwalk
+sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk.service.in > xwalk.service
 
 cp -a src/AUTHORS AUTHORS.chromium
 cp -a src/LICENSE LICENSE.chromium
@@ -216,9 +220,9 @@ fi
 cd src
 
 # Binaries.
-install -p -D %{SOURCE1} %{buildroot}%{_bindir}/xwalk
+install -p -D ../xwalk %{buildroot}%{_bindir}/xwalk
 install -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service
-install -p -D %{SOURCE3} %{buildroot}%{_systemduserservicedir}/xwalk.service
+install -p -D ../xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service
 install -p -D ${BUILDDIR_NAME}/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk
 install -p -D ${BUILDDIR_NAME}/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl
 install -p -D ${BUILDDIR_NAME}/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher
diff --git a/packaging/xwalk b/packaging/xwalk
deleted file mode 100755 (executable)
index ed4844e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec /usr/lib/xwalk/xwalk $@
diff --git a/packaging/xwalk.in b/packaging/xwalk.in
new file mode 100755 (executable)
index 0000000..a4b2873
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec @LIB_INSTALL_DIR@/xwalk/xwalk $@
diff --git a/packaging/xwalk.service b/packaging/xwalk.service
deleted file mode 100644 (file)
index b88392c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-[Unit]
-Description=Crosswalk
-
-[Service]
-Type=dbus
-BusName=org.crosswalkproject.Runtime1
-ExecStart=/usr/lib/xwalk/xwalk --run-as-service --external-extensions-path=/usr/lib/tizen-extensions-crosswalk
diff --git a/packaging/xwalk.service.in b/packaging/xwalk.service.in
new file mode 100644 (file)
index 0000000..e0d9b32
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=Crosswalk
+
+[Service]
+Type=dbus
+BusName=org.crosswalkproject.Runtime1
+ExecStart=@LIB_INSTALL_DIR@/xwalk/xwalk --run-as-service --external-extensions-path=@LIB_INSTALL_DIR@/tizen-extensions-crosswalk
index b02a526..9336e3b 100644 (file)
@@ -1,4 +1,4 @@
 MAJOR=5
 MINOR=34
-BUILD=97
+BUILD=98
 PATCH=0
index 96e2544..50834c6 100755 (executable)
@@ -26,14 +26,15 @@ def CleanDir(path):
     shutil.rmtree(path)
 
 
-def RunCommand(command, shell=False):
+def RunCommand(command, verbose=False, shell=False):
   """Runs the command list, print the output, and propagate its result."""
   proc = subprocess.Popen(command, stdout=subprocess.PIPE,
                           stderr=subprocess.STDOUT, shell=shell)
   if not shell:
     output = proc.communicate()[0]
     result = proc.returncode
-    print(output.decode("utf-8"))
+    if verbose:
+      print(output.decode("utf-8").strip())
     if result != 0:
       print ('Command "%s" exited with non-zero exit code %d'
              % (' '.join(command), result))
@@ -185,6 +186,7 @@ def MakeVersionCode(options):
   # features, according to recommendation in URL
   return '--app-versionCode=%s%s' % (abi, b.zfill(7))
 
+
 def Customize(options):
   package = '--package=org.xwalk.app.template'
   if options.package:
@@ -233,7 +235,7 @@ def Customize(options):
           name, app_version, app_versionCode, description, icon, permissions,
           app_url, remote_debugging, app_root, app_local_path, fullscreen_flag,
           extensions_list, orientation, default_image]
-  RunCommand(cmd)
+  RunCommand(cmd, options.verbose)
 
 
 def Execution(options, sanitized_name):
@@ -302,7 +304,7 @@ def Execution(options, sanitized_name):
   # Check whether ant is installed.
   try:
     cmd = ['ant', '-version']
-    RunCommand(cmd, True)
+    RunCommand(cmd, shell=True)
   except EnvironmentError:
     print('Please install ant first.')
     sys.exit(4)
@@ -364,12 +366,12 @@ def Execution(options, sanitized_name):
          '-Dbasedir=.',
          '-buildfile',
          os.path.join('scripts', 'ant', 'apk-codegen.xml')]
-  RunCommand(cmd)
+  RunCommand(cmd, options.verbose)
 
   # Check whether java is installed.
   try:
     cmd = ['java', '-version']
-    RunCommand(cmd, True)
+    RunCommand(cmd, shell=True)
   except EnvironmentError:
     print('Please install Oracle JDK first.')
     sys.exit(5)
@@ -412,7 +414,7 @@ def Execution(options, sanitized_name):
          '-Dbasedir=.',
          '-buildfile',
          xml_path]
-  RunCommand(cmd)
+  RunCommand(cmd, options.verbose)
 
   dex_path = '--dex-path=' + os.path.join(os.getcwd(), 'out', 'classes.dex')
   app_runtime_jar = os.path.join(os.getcwd(),
@@ -469,7 +471,7 @@ def Execution(options, sanitized_name):
          '-Dbasedir=.',
          '-buildfile',
          'scripts/ant/apk-package.xml']
-  RunCommand(cmd)
+  RunCommand(cmd, options.verbose)
 
   apk_path = '--unsigned-apk-path=' + os.path.join('out', 'app-unsigned.apk')
   final_apk_path = '--final-apk-path=' + \
@@ -562,6 +564,9 @@ def main(argv):
   parser.add_option('-v', '--version', action='store_true',
                     dest='version', default=False,
                     help='The version of this python tool.')
+  parser.add_option('--verbose', action="store_true",
+                    dest='verbose', default=False,
+                    help='Print debug messages.')
   info = ('The packaging mode of the web application. The value \'shared\' '
           'means that the runtime is shared across multiple application '
           'instances and that the runtime needs to be distributed separately. '
index ea7214a..c7e77d0 100755 (executable)
@@ -441,48 +441,39 @@ class TestMakeApk(unittest.TestCase):
   def testManifestWithError(self):
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_no_app_launch_path.json')
-    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path, self._mode]
+    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
+           '--verbose', self._mode]
     out = RunCommand(cmd)
     self.assertTrue(out.find('no app launch path') != -1)
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_no_name.json')
-    proc = subprocess.Popen(['python', 'make_apk.py',
-                             '--manifest=%s' % manifest_path,
-                             self._mode],
-                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    out, _ = proc.communicate()
+    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
+           '--verbose', self._mode]
+    out = RunCommand(cmd)
     self.assertTrue(out.find('no \'name\' field') != -1)
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_no_version.json')
-    proc = subprocess.Popen(['python', 'make_apk.py',
-                             '--manifest=%s' % manifest_path,
-                             self._mode],
-                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    out, _ = proc.communicate()
+    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
+           '--verbose', self._mode]
+    out = RunCommand(cmd)
     self.assertTrue(out.find('no \'version\' field') != -1)
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_permissions_format_error.json')
-    proc = subprocess.Popen(['python', 'make_apk.py',
-                             '--manifest=%s' % manifest_path,
-                             self._mode],
-                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    out, _ = proc.communicate()
+    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
+           '--verbose', self._mode]
+    out = RunCommand(cmd)
     self.assertTrue(out.find('\'Permissions\' field error') != -1)
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_permissions_field_error.json')
-    proc = subprocess.Popen(['python', 'make_apk.py',
-                             '--manifest=%s' % manifest_path,
-                             self._mode],
-                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    out, _ = proc.communicate()
+    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
+           '--verbose', self._mode]
+    out = RunCommand(cmd)
     self.assertTrue(out.find('\'Permissions\' field error') != -1)
     manifest_path = os.path.join('test_data', 'manifest',
                                  'manifest_not_supported_permission.json')
-    proc = subprocess.Popen(['python', 'make_apk.py',
-                             '--manifest=%s' % manifest_path,
-                             self._mode],
-                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-    out, _ = proc.communicate()
+    cmd = ['python', 'make_apk.py', '--manifest=%s' % manifest_path,
+           '--verbose', self._mode]
+    out = RunCommand(cmd)
     self.assertTrue(
         out.find('\'Telephony\' related API is not supported') != -1)
 
@@ -512,7 +503,7 @@ class TestMakeApk(unittest.TestCase):
     extension_path = 'test_data/extensions/myextension'
     cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
            '--package=org.xwalk.example', '--app-url=http://www.intel.com',
-           '--extensions=%s1' % extension_path, self._mode]
+           '--extensions=%s1' % extension_path, self._mode, '--verbose']
     out = RunCommand(cmd)
     error_msg = 'Error: can\'t find the extension directory'
     self.assertTrue(out.find(error_msg) != -1)
@@ -594,6 +585,20 @@ class TestMakeApk(unittest.TestCase):
       self.assertFalse(os.path.isfile('Example_1.0.0_x86.apk'))
       Clean('Example', '1.0.0')
 
+
+  def testVerbose(self):
+    cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
+           '--package=org.xwalk.example', '--app-url=http://www.intel.com',
+           '--verbose', self._mode]
+    result = RunCommand(cmd)
+    self.assertTrue(result.find('aapt') != -1)
+    self.assertTrue(result.find('crunch') != -1)
+    self.assertTrue(result.find('apkbuilder') != -1)
+    self.assertTrue(os.path.exists('Example'))
+    self.checkApks('Example', '1.0.0')
+    Clean('Example', '1.0.0')
+
+
   def testEmptyMode(self):
     # Test all of supported options with empty 'mode' option.
     icon_path = './app_src/res/drawable-xhdpi/crosswalk.png'
@@ -696,6 +701,7 @@ def SuiteWithEmptyModeOption():
   test_suite = unittest.TestSuite()
   test_suite.addTest(TestMakeApk('testEmptyMode'))
   test_suite.addTest(TestMakeApk('testToolVersion'))
+  test_suite.addTest(TestMakeApk('testVerbose'))
   return test_suite
 
 
index 8feafaa..39d16d2 100644 (file)
@@ -44,6 +44,8 @@ namespace keys = application_manifest_keys;
 
 namespace application {
 
+namespace {
+
 net::HttpResponseHeaders* BuildHttpHeaders(
     const std::string& content_security_policy,
     const std::string& mime_type, const std::string& method,
@@ -82,8 +84,6 @@ net::HttpResponseHeaders* BuildHttpHeaders(
   return new net::HttpResponseHeaders(raw_headers);
 }
 
-namespace {
-
 class GeneratedMainDocumentJob: public net::URLRequestSimpleJob {
  public:
   GeneratedMainDocumentJob(
index 37cf3e6..1f629a0 100644 (file)
@@ -5,26 +5,14 @@
 #ifndef XWALK_APPLICATION_BROWSER_APPLICATION_PROTOCOLS_H_
 #define XWALK_APPLICATION_BROWSER_APPLICATION_PROTOCOLS_H_
 
-#include <string>
-
-#include "base/files/file_path.h"
 #include "base/memory/linked_ptr.h"
 #include "net/url_request/url_request_job_factory.h"
 #include "xwalk/application/browser/application_system.h"
 
-namespace net {
-class HttpResponseHeaders;
-}
-
 namespace xwalk {
 namespace application {
 
 class ApplicationService;
-net::HttpResponseHeaders* BuildHttpHeaders(
-    const std::string& content_security_policy,
-    const std::string& mime_type, const std::string& method,
-    const base::FilePath& file_path, const base::FilePath& relative_path,
-    bool is_authority_match);
 
 // Creates the handlers for the app:// scheme.
 linked_ptr<net::URLRequestJobFactory::ProtocolHandler>
index d7bfd9a..38168ba 100644 (file)
@@ -115,7 +115,7 @@ class ExtensionServerMessageFilter : public IPC::ChannelProxy::MessageFilter,
 
     base::Closure closure = base::Bind(
         base::IgnoreResult(&XWalkExtensionServer::OnMessageReceived),
-        base::Unretained(server), message);
+        server->AsWeakPtr(), message);
 
     task_runner->PostTask(FROM_HERE, closure);
   }
@@ -138,7 +138,7 @@ class ExtensionServerMessageFilter : public IPC::ChannelProxy::MessageFilter,
 
     base::Closure closure = base::Bind(
         base::IgnoreResult(&XWalkExtensionServer::OnCreateInstance),
-        base::Unretained(server), instance_id, name);
+        server->AsWeakPtr(), instance_id, name);
 
     task_runner->PostTask(FROM_HERE, closure);
   }
index 3374d6d..4f06be4 100644 (file)
@@ -11,6 +11,7 @@
 #include <string>
 #include <vector>
 
+#include "base/memory/weak_ptr.h"
 #include "base/synchronization/lock.h"
 #include "base/values.h"
 #include "ipc/ipc_channel_proxy.h"
@@ -42,7 +43,8 @@ class XWalkExtensionInstance;
 //
 // This class is used both by in-process extensions running in the Browser
 // Process, and by the external extensions running in the Extension Process.
-class XWalkExtensionServer : public IPC::Listener {
+class XWalkExtensionServer : public IPC::Listener,
+    public base::SupportsWeakPtr<XWalkExtensionServer> {
  public:
   XWalkExtensionServer();
   virtual ~XWalkExtensionServer();
index 146cb99..331bad2 100644 (file)
@@ -2,16 +2,16 @@
 %bcond_with wayland
 
 Name:           crosswalk
-Version:        5.34.97.0
+Version:        5.34.98.0
 Release:        0
 Summary:        Crosswalk is an app runtime based on Chromium
 License:        (BSD-3-Clause and LGPL-2.1+)
 Group:          Web Framework/Web Run Time
 Url:            https://github.com/otcshare/crosswalk
 Source:         %{name}.tar
-Source1:        xwalk
+Source1:        xwalk.in
 Source2:        org.crosswalkproject.Runtime1.service
-Source3:        xwalk.service
+Source3:        xwalk.service.in
 Source1001:     crosswalk.manifest
 Source1002:     %{name}.xml.in
 Source1003:     %{name}.png
@@ -100,10 +100,14 @@ This package contains additional support files that are needed for running Cross
 %prep
 %setup -q -n crosswalk
 
+cp %{SOURCE1} .
+cp %{SOURCE3} .
 cp %{SOURCE1001} .
 cp %{SOURCE1002} .
 cp %{SOURCE1003} .
 sed "s/@VERSION@/%{version}/g" %{name}.xml.in > %{name}.xml
+sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk.in > xwalk
+sed "s|@LIB_INSTALL_DIR@|%{_libdir}|g" xwalk.service.in > xwalk.service
 
 cp -a src/AUTHORS AUTHORS.chromium
 cp -a src/LICENSE LICENSE.chromium
@@ -216,9 +220,9 @@ fi
 cd src
 
 # Binaries.
-install -p -D %{SOURCE1} %{buildroot}%{_bindir}/xwalk
+install -p -D ../xwalk %{buildroot}%{_bindir}/xwalk
 install -p -D %{SOURCE2} %{buildroot}%{_dbusservicedir}/org.crosswalkproject.Runtime1.service
-install -p -D %{SOURCE3} %{buildroot}%{_systemduserservicedir}/xwalk.service
+install -p -D ../xwalk.service %{buildroot}%{_systemduserservicedir}/xwalk.service
 install -p -D ${BUILDDIR_NAME}/out/Release/xwalk %{buildroot}%{_libdir}/xwalk/xwalk
 install -p -D ${BUILDDIR_NAME}/out/Release/xwalkctl %{buildroot}%{_bindir}/xwalkctl
 install -p -D ${BUILDDIR_NAME}/out/Release/xwalk-launcher %{buildroot}%{_bindir}/xwalk-launcher
diff --git a/src/xwalk/packaging/xwalk b/src/xwalk/packaging/xwalk
deleted file mode 100755 (executable)
index ed4844e..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-exec /usr/lib/xwalk/xwalk $@
diff --git a/src/xwalk/packaging/xwalk.in b/src/xwalk/packaging/xwalk.in
new file mode 100755 (executable)
index 0000000..a4b2873
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec @LIB_INSTALL_DIR@/xwalk/xwalk $@
diff --git a/src/xwalk/packaging/xwalk.service b/src/xwalk/packaging/xwalk.service
deleted file mode 100644 (file)
index b88392c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-[Unit]
-Description=Crosswalk
-
-[Service]
-Type=dbus
-BusName=org.crosswalkproject.Runtime1
-ExecStart=/usr/lib/xwalk/xwalk --run-as-service --external-extensions-path=/usr/lib/tizen-extensions-crosswalk
diff --git a/src/xwalk/packaging/xwalk.service.in b/src/xwalk/packaging/xwalk.service.in
new file mode 100644 (file)
index 0000000..e0d9b32
--- /dev/null
@@ -0,0 +1,7 @@
+[Unit]
+Description=Crosswalk
+
+[Service]
+Type=dbus
+BusName=org.crosswalkproject.Runtime1
+ExecStart=@LIB_INSTALL_DIR@/xwalk/xwalk --run-as-service --external-extensions-path=@LIB_INSTALL_DIR@/tizen-extensions-crosswalk
index e520919..cd79bc2 100644 (file)
@@ -8,6 +8,7 @@ import android.content.Context;
 import android.util.Log;
 
 import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
 
 public class XWalkInternalResources {
     private static final String TAG = "XWalkInternalResources";
@@ -40,7 +41,7 @@ public class XWalkInternalResources {
                     Field[] fields = innerClazz.getFields();
                     for (Field field : fields) {
                         // It's final means we are probably not used as library project.
-                        if (!field.isAccessible()) continue;
+                        if (Modifier.isFinal(field.getModifiers())) continue;
                         try {
                             int value = generatedInnerClazz.getField(field.getName()).getInt(null);
                             field.setInt(null, value);
index 657de75..f64b8a8 100644 (file)
@@ -9,15 +9,13 @@
 #include "base/android/jni_android.h"
 #include "base/android/jni_string.h"
 #include "jni/InterceptedRequestData_jni.h"
-#include "net/base/escape.h"
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_job.h"
 #include "xwalk/runtime/browser/android/net/android_protocol_handler.h"
 #include "xwalk/runtime/browser/android/net/android_stream_reader_url_request_job.h"
 #include "xwalk/runtime/browser/android/net/input_stream_impl.h"
 #include "xwalk/runtime/browser/runtime_context.h"
-#include "xwalk/runtime/browser/xwalk_browser_main_parts.h"
-#include "xwalk/runtime/browser/xwalk_content_browser_client.h"
+#include "xwalk/runtime/browser/xwalk_runner.h"
 
 using base::android::ScopedJavaLocalRef;
 
@@ -123,18 +121,13 @@ net::URLRequestJob* InterceptedRequestDataImpl::CreateJobFor(
   scoped_ptr<AndroidStreamReaderURLRequestJob::Delegate>
       stream_reader_job_delegate_impl(new StreamReaderJobDelegateImpl(this));
 
-  base::FilePath relative_path = base::FilePath(
-      net::UnescapeURLComponent(request->url().path(),
-          net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS));
-
-  xwalk::XWalkBrowserMainParts* main_parts =
-          xwalk::XWalkContentBrowserClient::Get()->main_parts();
-  xwalk::RuntimeContext* runtime_context = main_parts->runtime_context();
+  RuntimeContext* runtime_context =
+      XWalkRunner::GetInstance()->runtime_context();
   std::string content_security_policy = runtime_context->GetCSPString();
 
   return new AndroidStreamReaderURLRequestJob(
       request, network_delegate, stream_reader_job_delegate_impl.Pass(),
-      relative_path, content_security_policy);
+      content_security_policy);
 }
 
 }  // namespace xwalk
index 8b599ce..580f980 100644 (file)
@@ -24,8 +24,7 @@
 #include "xwalk/runtime/browser/android/net/input_stream_impl.h"
 #include "xwalk/runtime/browser/android/net/url_constants.h"
 #include "xwalk/runtime/browser/runtime_context.h"
-#include "xwalk/runtime/browser/xwalk_browser_main_parts.h"
-#include "xwalk/runtime/browser/xwalk_content_browser_client.h"
+#include "xwalk/runtime/browser/xwalk_runner.h"
 
 using base::android::AttachCurrentThread;
 using base::android::ClearException;
@@ -249,20 +248,14 @@ net::URLRequestJob* AndroidProtocolHandlerBase::MaybeCreateJob(
   scoped_ptr<AndroidStreamReaderURLRequestJobDelegateImpl> reader_delegate(
       new AndroidStreamReaderURLRequestJobDelegateImpl());
 
-  base::FilePath relative_path = base::FilePath(
-      net::UnescapeURLComponent(request->url().path(),
-          net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS));
-
-  xwalk::XWalkBrowserMainParts* main_parts =
-          xwalk::XWalkContentBrowserClient::Get()->main_parts();
-  xwalk::RuntimeContext* runtime_context = main_parts->runtime_context();
+  xwalk::RuntimeContext* runtime_context =
+      xwalk::XWalkRunner::GetInstance()->runtime_context();
   std::string content_security_policy = runtime_context->GetCSPString();
 
   return new AndroidStreamReaderURLRequestJob(
       request,
       network_delegate,
       reader_delegate.PassAs<AndroidStreamReaderURLRequestJob::Delegate>(),
-      relative_path,
       content_security_policy);
 }
 
index c81658c..295c961 100644 (file)
@@ -29,7 +29,6 @@
 #include "net/http/http_util.h"
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_job_manager.h"
-#include "xwalk/application/browser/application_protocols.h"
 #include "xwalk/runtime/browser/android/net/input_stream.h"
 #include "xwalk/runtime/browser/android/net/input_stream_reader.h"
 #include "xwalk/runtime/browser/android/net/url_constants.h"
@@ -98,12 +97,9 @@ AndroidStreamReaderURLRequestJob::AndroidStreamReaderURLRequestJob(
     net::URLRequest* request,
     net::NetworkDelegate* network_delegate,
     scoped_ptr<Delegate> delegate,
-    const base::FilePath& relative_path,
     const std::string& content_security_policy)
     : URLRequestJob(request, network_delegate),
       delegate_(delegate.Pass()),
-      mime_type_("text/html"),
-      relative_path_(relative_path),
       content_security_policy_(content_security_policy),
       weak_factory_(this) {
   DCHECK(delegate_);
@@ -365,6 +361,12 @@ void AndroidStreamReaderURLRequestJob::HeadersComplete(
       content_type_header.append(mime_type);
       headers->AddHeader(content_type_header);
     }
+
+    if (!content_security_policy_.empty()) {
+      std::string content_security_policy("Content-Security-Policy: ");
+      content_security_policy.append(content_security_policy_);
+      headers->AddHeader(content_security_policy);
+    }
   }
 
   response_info_.reset(new net::HttpResponseInfo());
@@ -381,11 +383,8 @@ int AndroidStreamReaderURLRequestJob::GetResponseCode() const {
 
 void AndroidStreamReaderURLRequestJob::GetResponseInfo(
     net::HttpResponseInfo* info) {
-  if (response_info_) {
-    // TODO(gaochun): Enable CSP when http status code issue was fixed.
-    // Bug: https://crosswalk-project.org/jira/browse/XWALK-1022
+  if (response_info_)
     *info = *response_info_;
-  }
 }
 
 void AndroidStreamReaderURLRequestJob::SetExtraRequestHeaders(
index 35f9150..6279a3d 100644 (file)
@@ -8,7 +8,6 @@
 #include <string>
 
 #include "base/android/scoped_java_ref.h"
-#include "base/files/file_path.h"
 #include "base/location.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
@@ -78,7 +77,6 @@ class AndroidStreamReaderURLRequestJob : public net::URLRequestJob {
       net::URLRequest* request,
       net::NetworkDelegate* network_delegate,
       scoped_ptr<Delegate> delegate,
-      const base::FilePath& relative_path,
       const std::string& content_security_policy);
 
   // URLRequestJob:
@@ -118,8 +116,6 @@ class AndroidStreamReaderURLRequestJob : public net::URLRequestJob {
   net::HttpByteRange byte_range_;
   scoped_ptr<net::HttpResponseInfo> response_info_;
   scoped_ptr<Delegate> delegate_;
-  const std::string mime_type_;
-  base::FilePath relative_path_;
   std::string content_security_policy_;
   scoped_refptr<InputStreamReaderWrapper> input_stream_reader_wrapper_;
   base::WeakPtrFactory<AndroidStreamReaderURLRequestJob> weak_factory_;
index e670c65..d62009e 100644 (file)
@@ -35,8 +35,7 @@
 #include "xwalk/runtime/browser/android/xwalk_web_contents_delegate.h"
 #include "xwalk/runtime/browser/runtime_context.h"
 #include "xwalk/runtime/browser/runtime_resource_dispatcher_host_delegate_android.h"
-#include "xwalk/runtime/browser/xwalk_browser_main_parts.h"
-#include "xwalk/runtime/browser/xwalk_content_browser_client.h"
+#include "xwalk/runtime/browser/xwalk_runner.h"
 #include "jni/XWalkContent_jni.h"
 
 using base::android::AttachCurrentThread;
@@ -120,11 +119,8 @@ content::WebContents* XWalkContent::CreateWebContents(
     JNIEnv* env, jobject io_thread_client,
     jobject intercept_navigation_delegate) {
 
-  XWalkBrowserMainParts* main_parts =
-          XWalkContentBrowserClient::Get()->main_parts();
-  CHECK(main_parts);
-  // FIXME : need a better way to get context.
-  RuntimeContext* runtime_context = main_parts->runtime_context();
+  RuntimeContext* runtime_context =
+      XWalkRunner::GetInstance()->runtime_context();
   CHECK(runtime_context);
 
   content::WebContents* web_contents = content::WebContents::Create(
@@ -235,10 +231,8 @@ jboolean XWalkContent::SetManifest(JNIEnv* env,
   std::string csp;
   manifest.GetString(
       xwalk::application_manifest_keys::kCSPKey, &csp);
-  XWalkBrowserMainParts* main_parts =
-          XWalkContentBrowserClient::Get()->main_parts();
-  CHECK(main_parts);
-  RuntimeContext* runtime_context = main_parts->runtime_context();
+  RuntimeContext* runtime_context =
+      XWalkRunner::GetInstance()->runtime_context();
   CHECK(runtime_context);
   runtime_context->SetCSPString(csp);
 
index dbeaef8..38734e0 100644 (file)
@@ -165,7 +165,6 @@ void XWalkBrowserMainParts::RegisterExternalExtensions() {
 void XWalkBrowserMainParts::PreMainMessageLoopRun() {
   xwalk_runner_->PreMainMessageLoopRun();
 
-  runtime_context_ = xwalk_runner_->runtime_context();
   extension_service_ = xwalk_runner_->extension_service();
 
   if (extension_service_)
@@ -179,7 +178,7 @@ void XWalkBrowserMainParts::PreMainMessageLoopRun() {
     const char* local_ip = "0.0.0.0";
     if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) {
       remote_debugging_server_.reset(
-          new RemoteDebuggingServer(runtime_context_,
+          new RemoteDebuggingServer(xwalk_runner_->runtime_context(),
               local_ip, port, std::string()));
     }
   }
index e98bc0e..a174467 100644 (file)
@@ -22,7 +22,6 @@ class RenderProcessHost;
 
 namespace xwalk {
 
-class RuntimeContext;
 class RemoteDebuggingServer;
 class XWalkRunner;
 
@@ -57,8 +56,6 @@ class XWalkBrowserMainParts : public content::BrowserMainParts {
       extensions::XWalkExtensionVector* extensions);
 
 #if defined(OS_ANDROID)
-  RuntimeContext* runtime_context() { return runtime_context_; }
-
   // XWalkExtensionAndroid needs to register its extensions on
   // XWalkBrowserMainParts so they get correctly registered on-demand
   // by XWalkExtensionService each time a in_process Server is created.
@@ -71,8 +68,6 @@ class XWalkBrowserMainParts : public content::BrowserMainParts {
 
   XWalkRunner* xwalk_runner_;
 
-  RuntimeContext* runtime_context_;
-
   extensions::XWalkExtensionService* extension_service_;
 
   // Should be about:blank If no URL is specified in command line arguments.
index 50fc75e..1d4b4dc 100644 (file)
@@ -122,7 +122,6 @@ void XWalkBrowserMainPartsAndroid::PreMainMessageLoopRun() {
 
   xwalk_runner_->PreMainMessageLoopRun();
 
-  runtime_context_ = xwalk_runner_->runtime_context();
   extension_service_ = xwalk_runner_->extension_service();
 
   // Prepare the cookie store.
index f62d02f..808afed 100644 (file)
@@ -318,10 +318,8 @@ public class XWalkClientShouldInterceptRequestTest extends XWalkViewTestBase {
         }
     }
 
-    //@SmallTest
-    //@Feature({"XWalkClientShouldInterceptRequest"})
-    // TODO(gaochun): Enable it once the issue XWALK-1022 gets resolved.
-    @DisabledTest
+    @SmallTest
+    @Feature({"XWalkClientShouldInterceptRequest"})
     public void testHttpStatusField() throws Throwable {
         final String syncGetUrl = mWebServer.getResponseUrl("/intercept_me");
         final String syncGetJs =
index c7ff11b..600c490 100644 (file)
@@ -6,7 +6,6 @@
 package org.xwalk.runtime.client.test;
 
 import android.test.suitebuilder.annotation.SmallTest;
-import org.chromium.base.test.util.DisabledTest;
 import org.chromium.base.test.util.Feature;
 import org.xwalk.runtime.client.shell.XWalkRuntimeClientShellActivity;
 import org.xwalk.test.util.RuntimeClientApiTestBase;
@@ -16,11 +15,8 @@ import org.xwalk.test.util.RuntimeClientApiTestBase;
  */
 public class CSPTest extends XWalkRuntimeClientTestBase {
 
-    // TODO(gaochun): Enable the test when the issue was fixed:
-    // Bug: https://crosswalk-project.org/jira/browse/XWALK-1022
-    // @SmallTest
-    // @Feature({"CSP"})
-    @DisabledTest
+    @SmallTest
+    @Feature({"CSP"})
     public void testCSP() throws Throwable {
         RuntimeClientApiTestBase<XWalkRuntimeClientShellActivity> helper =
                 new RuntimeClientApiTestBase<XWalkRuntimeClientShellActivity>(
index 562995a..9f12517 100644 (file)
@@ -6,7 +6,6 @@
 package org.xwalk.runtime.client.embedded.test;
 
 import android.test.suitebuilder.annotation.SmallTest;
-import org.chromium.base.test.util.DisabledTest;
 import org.chromium.base.test.util.Feature;
 import org.xwalk.runtime.client.embedded.shell.XWalkRuntimeClientEmbeddedShellActivity;
 import org.xwalk.test.util.RuntimeClientApiTestBase;
@@ -16,11 +15,8 @@ import org.xwalk.test.util.RuntimeClientApiTestBase;
  */
 public class CSPTest extends XWalkRuntimeClientTestBase {
 
-    // TODO(gaochun): Enable the test when the issue was fixed:
-    // Bug: https://crosswalk-project.org/jira/browse/XWALK-1022
-    // @SmallTest
-    // @Feature({"CSP"})
-    @DisabledTest
+    @SmallTest
+    @Feature({"CSP"})
     public void testCSP() throws Throwable {
         RuntimeClientApiTestBase<XWalkRuntimeClientEmbeddedShellActivity> helper =
                 new RuntimeClientApiTestBase<XWalkRuntimeClientEmbeddedShellActivity>(