Version 1.13.0-dev.7.8
Commit of https://codereview.chromium.org/1422853007 to dev
Cherry-pick 7ea2b300f12ad115d5eb70200055f24e173c7c50 to dev
Cherry-pick c34b23ccfe35b9e623d1f9367ae590e8a6798302 to dev
Cherry-pick 53b506b1bf45bf73f568d14b7c285000afe02825 to dev
Cherry-pick a98388886a9e30bdb15b7800314b9a103b2910fe to dev
Cherry-pick be025b841211c5589f162e206160e656c81a8f83 to dev
Cherry-pick 12e94fc1d92995da5ebedbd345cc888727d39e47 to dev
Cherry-pick 7f546e9e0c6bb23afef071a1082cd8acf310ebbd to dev
Cherry-pick e0f8e96dae2c82005dc13499b674d43c059b7a29 to dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 638c5fd..0b35edd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,10 @@
See https://pub.dartlang.org/packages/resource to learn more. This is
the last release to contain the Resource class.
+* `dart:developer`
+ * Added `Timeline` class for interacting with Observatory's timeline feature.
+ * Added `ServiceExtensionHandler`, `ServiceExtensionResponse`, and `registerExtension` which enable developers to provide their own VM service protocol extensions.
+
* `dart:io`
* **Breaking:** Secure networking has changed, replacing the NSS library
with the BoringSSL library. `SecureSocket`, `SecureServerSocket`,
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index 687bea3..8ac784a 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -423,7 +423,7 @@
functionType = returnType;
} else if (returnType.treatAsDynamic ||
_compiler.types.isSubtype(returnType,
- backend.coreTypes.functionType)) {
+ backend.resolution.coreTypes.functionType)) {
if (returnType.isTypedef) {
TypedefType typedef = returnType;
// TODO(jacobr): can we just use typdef.unaliased instead?
diff --git a/runtime/lib/profiler_sources.gypi b/runtime/lib/profiler_sources.gypi
new file mode 100644
index 0000000..9175427
--- /dev/null
+++ b/runtime/lib/profiler_sources.gypi
@@ -0,0 +1,12 @@
+# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# Sources list to keep vm/BUILD.gn generate_core_libraries happy.
+
+{
+ 'sources': [
+ 'empty_source.dart'
+ ],
+}
+
diff --git a/runtime/vm/BUILD.gn b/runtime/vm/BUILD.gn
index 0afda71..2db9a6e 100644
--- a/runtime/vm/BUILD.gn
+++ b/runtime/vm/BUILD.gn
@@ -193,6 +193,7 @@
["isolate", "isolate"],
["math", "math"],
["mirrors", "mirrors"],
+ ["profiler", "profiler"],
["typed_data", "typed_data"],
["_vmservice", "vmservice"],
]
diff --git a/runtime/vm/bootstrap.cc b/runtime/vm/bootstrap.cc
index c445f4a..85fcf52 100644
--- a/runtime/vm/bootstrap.cc
+++ b/runtime/vm/bootstrap.cc
@@ -67,6 +67,10 @@
mirrors,
Bootstrap::mirrors_source_paths_,
Bootstrap::mirrors_patch_paths_),
+ INIT_LIBRARY(ObjectStore::kProfiler,
+ profiler,
+ Bootstrap::profiler_source_paths_,
+ NULL),
INIT_LIBRARY(ObjectStore::kTypedData,
typed_data,
Bootstrap::typed_data_source_paths_,
diff --git a/runtime/vm/bootstrap.h b/runtime/vm/bootstrap.h
index 4cae370..eb238ed 100644
--- a/runtime/vm/bootstrap.h
+++ b/runtime/vm/bootstrap.h
@@ -30,6 +30,7 @@
static const char* json_source_paths_[];
static const char* math_source_paths_[];
static const char* mirrors_source_paths_[];
+ static const char* profiler_source_paths_[];
static const char* typed_data_source_paths_[];
static const char* utf_source_paths_[];
static const char* _vmservice_source_paths_[];
@@ -44,6 +45,7 @@
static const char* isolate_patch_paths_[];
static const char* math_patch_paths_[];
static const char* mirrors_patch_paths_[];
+ static const char* profiler_patch_paths_[];
static const char* typed_data_patch_paths_[];
static const char* _vmservice_patch_paths_[];
};
diff --git a/runtime/vm/bootstrap_natives.cc b/runtime/vm/bootstrap_natives.cc
index 2e705ec..d0bef86 100644
--- a/runtime/vm/bootstrap_natives.cc
+++ b/runtime/vm/bootstrap_natives.cc
@@ -121,6 +121,11 @@
library.set_native_entry_resolver(resolver);
library.set_native_entry_symbol_resolver(symbol_resolver);
+ library = Library::ProfilerLibrary();
+ ASSERT(!library.IsNull());
+ library.set_native_entry_resolver(resolver);
+ library.set_native_entry_symbol_resolver(symbol_resolver);
+
library = Library::TypedDataLibrary();
ASSERT(!library.IsNull());
library.set_native_entry_resolver(resolver);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 6110846..e0247e6 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -10276,6 +10276,11 @@
}
+RawLibrary* Library::ProfilerLibrary() {
+ return Isolate::Current()->object_store()->profiler_library();
+}
+
+
RawLibrary* Library::TypedDataLibrary() {
return Isolate::Current()->object_store()->typed_data_library();
}
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 2c94f2d..1193686 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3468,6 +3468,7 @@
static RawLibrary* MathLibrary();
static RawLibrary* MirrorsLibrary();
static RawLibrary* NativeWrappersLibrary();
+ static RawLibrary* ProfilerLibrary();
static RawLibrary* TypedDataLibrary();
static RawLibrary* VMServiceLibrary();
diff --git a/runtime/vm/object_store.cc b/runtime/vm/object_store.cc
index e70c76a..d8f2f6c 100644
--- a/runtime/vm/object_store.cc
+++ b/runtime/vm/object_store.cc
@@ -68,6 +68,7 @@
math_library_(Library::null()),
mirrors_library_(Library::null()),
native_wrappers_library_(Library::null()),
+ profiler_library_(Library::null()),
root_library_(Library::null()),
typed_data_library_(Library::null()),
vmservice_library_(Library::null()),
diff --git a/runtime/vm/object_store.h b/runtime/vm/object_store.h
index ed902e0..805b9b1 100644
--- a/runtime/vm/object_store.h
+++ b/runtime/vm/object_store.h
@@ -30,6 +30,7 @@
kIsolate,
kMath,
kMirrors,
+ kProfiler,
kTypedData,
kVMService,
};
@@ -263,6 +264,7 @@
RawLibrary* isolate_library() const { return isolate_library_; }
RawLibrary* math_library() const { return math_library_; }
RawLibrary* mirrors_library() const { return mirrors_library_; }
+ RawLibrary* profiler_library() const { return profiler_library_; }
RawLibrary* typed_data_library() const { return typed_data_library_; }
RawLibrary* vmservice_library() const { return vmservice_library_; }
@@ -295,6 +297,9 @@
case kMirrors:
mirrors_library_ = value.raw();
break;
+ case kProfiler:
+ profiler_library_ = value.raw();
+ break;
case kTypedData:
typed_data_library_ = value.raw();
break;
@@ -517,6 +522,7 @@
RawLibrary* math_library_;
RawLibrary* mirrors_library_;
RawLibrary* native_wrappers_library_;
+ RawLibrary* profiler_library_;
RawLibrary* root_library_;
RawLibrary* typed_data_library_;
RawLibrary* vmservice_library_;
diff --git a/runtime/vm/vm.gypi b/runtime/vm/vm.gypi
index 3b2e620..9771a91 100644
--- a/runtime/vm/vm.gypi
+++ b/runtime/vm/vm.gypi
@@ -25,6 +25,7 @@
'math_patch_cc_file': '<(gen_source_dir)/math_patch_gen.cc',
'mirrors_cc_file': '<(gen_source_dir)/mirrors_gen.cc',
'mirrors_patch_cc_file': '<(gen_source_dir)/mirrors_patch_gen.cc',
+ 'profiler_cc_file': '<(gen_source_dir)/profiler_gen.cc',
'snapshot_test_dat_file': '<(gen_source_dir)/snapshot_test.dat',
'snapshot_test_in_dat_file': 'snapshot_test_in.dat',
'snapshot_test_dart_file': 'snapshot_test.dart',
@@ -180,6 +181,7 @@
'generate_math_patch_cc_file#host',
'generate_mirrors_cc_file#host',
'generate_mirrors_patch_cc_file#host',
+ 'generate_profiler_cc_file#host',
'generate_typed_data_cc_file#host',
'generate_typed_data_patch_cc_file#host',
'generate_vmservice_cc_file#host',
@@ -218,6 +220,7 @@
'<(math_patch_cc_file)',
'<(mirrors_cc_file)',
'<(mirrors_patch_cc_file)',
+ '<(profiler_cc_file)',
'<(typed_data_cc_file)',
'<(typed_data_patch_cc_file)',
'<(vmservice_cc_file)',
@@ -970,6 +973,46 @@
]
},
{
+ 'target_name': 'generate_profiler_cc_file',
+ 'type': 'none',
+ 'toolsets':['host'],
+ 'includes': [
+ # Load the shared library sources.
+ '../../sdk/lib/profiler/profiler_sources.gypi',
+ ],
+ 'sources/': [
+ # Exclude all .[cc|h] files.
+ # This is only here for reference. Excludes happen after
+ # variable expansion, so the script has to do its own
+ # exclude processing of the sources being passed.
+ ['exclude', '\\.cc|h$'],
+ ],
+ 'actions': [
+ {
+ 'action_name': 'generate_profiler_cc',
+ 'inputs': [
+ '../tools/gen_library_src_paths.py',
+ '<(libgen_in_cc_file)',
+ '<@(_sources)',
+ ],
+ 'outputs': [
+ '<(profiler_cc_file)',
+ ],
+ 'action': [
+ 'python',
+ 'tools/gen_library_src_paths.py',
+ '--output', '<(profiler_cc_file)',
+ '--input_cc', '<(libgen_in_cc_file)',
+ '--include', 'vm/bootstrap.h',
+ '--var_name', 'dart::Bootstrap::profiler_source_paths_',
+ '--library_name', 'dart:profiler',
+ '<@(_sources)',
+ ],
+ 'message': 'Generating ''<(profiler_cc_file)'' file.'
+ },
+ ]
+ },
+ {
'target_name': 'generate_developer_cc_file',
'type': 'none',
'toolsets':['host'],
diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
index d1f0c7b..109eca3 100644
--- a/sdk/lib/html/dartium/html_dartium.dart
+++ b/sdk/lib/html/dartium/html_dartium.dart
@@ -9495,7 +9495,10 @@
DataTransferItem operator[] (int index) {
- return __getter__(index);
+ // TODO(alanknight): I think that all the __getter__ generators should just
+ // do property access, but that's major surgery. This one is a problem, so
+ // just hard-code it for now.
+ return _blink.Blink_JsNative_DomException.getProperty(unwrap_jso(this), index);
}
}
@@ -24400,7 +24403,7 @@
@DomName('Location.ancestorOrigins')
@DocsEditable()
@Experimental() // nonstandard
- List<String> get ancestorOrigins => _blink.BlinkLocation.instance.ancestorOrigins_Getter_(unwrap_jso(this));
+ List<String> get ancestorOrigins => wrap_jso(_blink.BlinkLocation.instance.ancestorOrigins_Getter_(unwrap_jso(this)));
@DomName('Location.hash')
@DocsEditable()
@@ -35155,7 +35158,7 @@
@DomName('StorageQuota.supportedTypes')
@DocsEditable()
@Experimental() // untriaged
- List<String> get supportedTypes => _blink.BlinkStorageQuota.instance.supportedTypes_Getter_(unwrap_jso(this));
+ List<String> get supportedTypes => wrap_jso(_blink.BlinkStorageQuota.instance.supportedTypes_Getter_(unwrap_jso(this)));
@DomName('StorageQuota.queryInfo')
@DocsEditable()
diff --git a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
index 6272bbf..c75130a 100644
--- a/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
+++ b/sdk/lib/indexed_db/dartium/indexed_db_dartium.dart
@@ -358,7 +358,7 @@
@DomName('IDBDatabase.objectStoreNames')
@DocsEditable()
- List<String> get objectStoreNames => _blink.BlinkIDBDatabase.instance.objectStoreNames_Getter_(unwrap_jso(this));
+ List<String> get objectStoreNames => wrap_jso(_blink.BlinkIDBDatabase.instance.objectStoreNames_Getter_(unwrap_jso(this)));
@DomName('IDBDatabase.version')
@DocsEditable()
@@ -998,7 +998,7 @@
@DomName('IDBObjectStore.indexNames')
@DocsEditable()
- List<String> get indexNames => _blink.BlinkIDBObjectStore.instance.indexNames_Getter_(unwrap_jso(this));
+ List<String> get indexNames => wrap_jso(_blink.BlinkIDBObjectStore.instance.indexNames_Getter_(unwrap_jso(this)));
@DomName('IDBObjectStore.keyPath')
@DocsEditable()
diff --git a/sdk/lib/js/dartium/js_dartium.dart b/sdk/lib/js/dartium/js_dartium.dart
index fde9d40..b01dce0 100644
--- a/sdk/lib/js/dartium/js_dartium.dart
+++ b/sdk/lib/js/dartium/js_dartium.dart
@@ -1177,6 +1177,20 @@
dynamic _apply(List args, {thisArg}) native "JsFunction_apply";
+ call([a1 = _UNDEFINED,
+ a2 = _UNDEFINED,
+ a3 = _UNDEFINED,
+ a4 = _UNDEFINED,
+ a5 = _UNDEFINED,
+ a6 = _UNDEFINED,
+ a7 = _UNDEFINED,
+ a8 = _UNDEFINED,
+ a9 = _UNDEFINED,
+ a10 = _UNDEFINED]) {
+ return apply(
+ _stripUndefinedArgs([a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]));
+ }
+
noSuchMethod(Invocation invocation) {
if (invocation.isMethod && invocation.memberName == #call) {
return apply(_buildArgs(invocation));
diff --git a/sdk/lib/profiler/profiler.dart b/sdk/lib/profiler/profiler.dart
new file mode 100644
index 0000000..84add7b
--- /dev/null
+++ b/sdk/lib/profiler/profiler.dart
@@ -0,0 +1,14 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Please see 'dart:developer'.
+@Deprecated("Dart SDK 1.12")
+library dart.profiler;
+
+export 'dart:developer' show getCurrentTag,
+ Counter,
+ Gauge,
+ Metric,
+ Metrics,
+ UserTag;
diff --git a/sdk/lib/profiler/profiler_sources.gypi b/sdk/lib/profiler/profiler_sources.gypi
new file mode 100644
index 0000000..910d798
--- /dev/null
+++ b/sdk/lib/profiler/profiler_sources.gypi
@@ -0,0 +1,10 @@
+# Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+{
+ 'sources': [
+ 'profiler.dart',
+ # The above file needs to be first if additional parts are added to the lib.
+ ],
+}
diff --git a/tests/html/html.status b/tests/html/html.status
index f5db897..43481ee 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -32,6 +32,10 @@
input_element_test/attributes: Fail # Issue 21555
wrapping_collections_test: SkipByDesign # Testing an issue that is only relevant to Dartium
+[ $compiler == dart2js && $checked ]
+js_function_getter_trust_types_test: Skip # --trust-type-annotations incompatible with --checked
+js_typed_interop_test: Fail # Issue 24822
+
[ $compiler == dart2js && $csp && $browser ]
custom/js_custom_test: Fail # Issue 14643
custom/element_upgrade_test: Fail # Issue 17298
diff --git a/tests/html/js_typed_interop_test.dart b/tests/html/js_typed_interop_test.dart
index 2907142..0e7cd0c 100644
--- a/tests/html/js_typed_interop_test.dart
+++ b/tests/html/js_typed_interop_test.dart
@@ -29,6 +29,10 @@
multiplyByX: function(arg) { return arg * this.x; },
// This function can be torn off without having to bind this.
multiplyBy2: function(arg) { return arg * 2; },
+ multiplyDefault2Function: function(a, b) {
+ if (arguments.length >= 2) return a * b;
+ return a * 2;
+ },
callClosureWithArg1: function(closure, arg) {
return closure(arg);
},
@@ -101,17 +105,21 @@
external get b;
}
+typedef num MultiplyWithDefault(num a, [num b]);
+
@JS()
class Foo {
external int get x;
external set x(int v);
external num multiplyByX(num y);
external num multiplyBy2(num y);
+ external MultiplyWithDefault get multiplyDefault2Function;
+
external callClosureWithArgAndThis(Function closure, arg);
external callClosureWithArg1(Function closure, arg1);
external callClosureWithArg2(Function closure, arg1, arg2);
external Bar getBar();
- external static int multiplyDefault2(int a, [int b]);
+ external static num multiplyDefault2(num a, [num b]);
}
@anonymous
@@ -237,6 +245,21 @@
// Tearing off a JS closure doesn't bind this.
// You will need to use the new method tearoff syntax to bind this.
expect(multiplyByX(4), isNaN);
+
+ MultiplyWithDefault multiplyWithDefault = foo.multiplyDefault2Function;
+ expect(multiplyWithDefault(6, 6), equals(36));
+ expect(multiplyWithDefault(6), equals(12));
+ Function untypedFunction = foo.multiplyDefault2Function;
+ // Calling with extra bogus arguments has no impact for JavaScript
+ // methods.
+ expect(untypedFunction(6, 6, "ignored", "ignored"), equals(36));
+ expect(untypedFunction(6, 6, "ignored", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), equals(36));
+ // Calling a JavaScript method with too few arguments is also fine and
+ // defaults to JavaScript behavior of setting all unspecified arguments
+ // to undefined resulting in multiplying undefined by 2 == NAN.
+ expect(untypedFunction(), isNaN);
+
});
});
@@ -244,9 +267,10 @@
test('call from dart', () {
expect(Foo.multiplyDefault2(6, 7), equals(42));
expect(Foo.multiplyDefault2(6), equals(12));
- Function tearOffMethod = Foo.multiplyDefault2;
+ MultiplyWithDefault tearOffMethod = Foo.multiplyDefault2;
expect(tearOffMethod(6, 6), equals(36));
expect(tearOffMethod(6), equals(12));
+ Function untypedTearOff = Foo.multiplyDefault2;
});
});
diff --git a/tools/VERSION b/tools/VERSION
index aee7ef0..7486ef6 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 13
PATCH 0
PRERELEASE 7
-PRERELEASE_PATCH 7
+PRERELEASE_PATCH 8
diff --git a/tools/create_sdk.py b/tools/create_sdk.py
index bdb69f2..f377798 100755
--- a/tools/create_sdk.py
+++ b/tools/create_sdk.py
@@ -145,7 +145,7 @@
PACKAGES_FILE = join(DARTDOC, '.packages')
packages_file = open(PACKAGES_FILE, 'w')
packages_file.write('dartdoc:.')
- packages_file.close()
+ packages_file.close()
def Main():
@@ -232,7 +232,7 @@
join('html', 'dart2js'), join('html', 'dartium'),
join('html', 'html_common'),
join('indexed_db', 'dart2js'), join('indexed_db', 'dartium'),
- 'js', 'math', 'mirrors', 'typed_data',
+ 'js', 'math', 'mirrors', 'profiler', 'typed_data',
join('svg', 'dart2js'), join('svg', 'dartium'),
join('web_audio', 'dart2js'), join('web_audio', 'dartium'),
join('web_gl', 'dart2js'), join('web_gl', 'dartium'),
diff --git a/tools/dom/scripts/generator.py b/tools/dom/scripts/generator.py
index 6f31a7d..2cdc750 100644
--- a/tools/dom/scripts/generator.py
+++ b/tools/dom/scripts/generator.py
@@ -1447,7 +1447,7 @@
return_type == 'SqlDatabase' or # renamed to Database
return_type == 'HTMLElement' or
return_type == 'MutationObserver' or
- return_type.endswith('[]'))
+ (return_type.endswith('[]') and return_type != 'DOMString[]'))
def wrap_type_blink(return_type, type_registry):
"""Returns True if the type is a blink type that requires wrap_jso but
diff --git a/tools/dom/scripts/systemnative.py b/tools/dom/scripts/systemnative.py
index 0e16172..3fc0638 100644
--- a/tools/dom/scripts/systemnative.py
+++ b/tools/dom/scripts/systemnative.py
@@ -1753,9 +1753,7 @@
elif wrap_unwrap_list[0]:
jso_util_method = 'wrap_jso'
- # Always return List<String> unwrapped.
- if return_type != 'List<String>':
- emit_template = emit_jso_template % jso_util_method
+ emit_template = emit_jso_template % jso_util_method
if caller_emitter:
caller_emitter.Emit(emit_template,
diff --git a/tools/dom/templates/html/impl/impl_DataTransferItemList.darttemplate b/tools/dom/templates/html/impl/impl_DataTransferItemList.darttemplate
index 54acce1..31455d6 100644
--- a/tools/dom/templates/html/impl/impl_DataTransferItemList.darttemplate
+++ b/tools/dom/templates/html/impl/impl_DataTransferItemList.darttemplate
@@ -12,7 +12,10 @@
$if DART2JS
return JS('DataTransferItem', '#[#]', this, index);
$else
- return __getter__(index);
+ // TODO(alanknight): I think that all the __getter__ generators should just
+ // do property access, but that's major surgery. This one is a problem, so
+ // just hard-code it for now.
+ return _blink.Blink_JsNative_DomException.getProperty(unwrap_jso(this), index);
$endif
}