diff --git a/DEPS b/DEPS index 297932ae..946d763 100644 --- a/DEPS +++ b/DEPS
@@ -44,7 +44,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '70bee166dec1536f22462d1770fa274bdfe789a6', + 'v8_revision': 'cf7481bd9da7cbdc4c3c15e6bb4014ede1d954c7', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other.
diff --git a/cc/trees/layer_tree_impl.h b/cc/trees/layer_tree_impl.h index 401a9c5e..750605a 100644 --- a/cc/trees/layer_tree_impl.h +++ b/cc/trees/layer_tree_impl.h
@@ -56,7 +56,7 @@ class CC_EXPORT LayerTreeImpl { public: - // This is the number of times a fixed point has to be hit contiuously by a + // This is the number of times a fixed point has to be hit continuously by a // layer to consider it as jittering. enum : int { kFixedPointHitsThreshold = 3 }; LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl,
diff --git a/content/browser/shared_worker/shared_worker_host.cc b/content/browser/shared_worker/shared_worker_host.cc index d3f4e1d..ceecae23 100644 --- a/content/browser/shared_worker/shared_worker_host.cc +++ b/content/browser/shared_worker/shared_worker_host.cc
@@ -94,10 +94,8 @@ params.route_id = worker_route_id_; Send(new WorkerProcessMsg_CreateWorker(params)); - for (FilterList::const_iterator i = filters_.begin(); i != filters_.end(); - ++i) { - i->filter()->Send(new ViewMsg_WorkerCreated(i->route_id())); - } + for (const FilterInfo& info : filters_) + info.filter()->Send(new ViewMsg_WorkerCreated(info.route_id())); } bool SharedWorkerHost::FilterMessage(const IPC::Message& message, @@ -177,20 +175,17 @@ base::TimeTicks::Now() - creation_time_); if (!instance_) return; - for (FilterList::const_iterator i = filters_.begin(); i != filters_.end(); - ++i) { - i->filter()->Send(new ViewMsg_WorkerScriptLoadFailed(i->route_id())); - } + for (const FilterInfo& info : filters_) + info.filter()->Send(new ViewMsg_WorkerScriptLoadFailed(info.route_id())); } void SharedWorkerHost::WorkerConnected(int message_port_id) { if (!instance_) return; - for (FilterList::const_iterator i = filters_.begin(); i != filters_.end(); - ++i) { - if (i->message_port_id() != message_port_id) + for (const FilterInfo& info : filters_) { + if (info.message_port_id() != message_port_id) continue; - i->filter()->Send(new ViewMsg_WorkerConnected(i->route_id())); + info.filter()->Send(new ViewMsg_WorkerConnected(info.route_id())); return; } } @@ -277,12 +272,9 @@ return result; const WorkerDocumentSet::DocumentInfoSet& documents = worker_document_set_->documents(); - for (WorkerDocumentSet::DocumentInfoSet::const_iterator doc = - documents.begin(); - doc != documents.end(); - ++doc) { + for (const WorkerDocumentSet::DocumentInfo& doc : documents) { result.push_back( - std::make_pair(doc->render_process_id(), doc->render_frame_id())); + std::make_pair(doc.render_process_id(), doc.render_frame_id())); } return result; }
diff --git a/content/common/associated_interface_provider_impl.cc b/content/common/associated_interface_provider_impl.cc index 454250d..43421078 100644 --- a/content/common/associated_interface_provider_impl.cc +++ b/content/common/associated_interface_provider_impl.cc
@@ -4,20 +4,16 @@ #include "content/common/associated_interface_provider_impl.h" #include "mojo/public/cpp/bindings/associated_binding.h" -#include "mojo/public/cpp/bindings/binding.h" namespace content { class AssociatedInterfaceProviderImpl::LocalProvider - : public mojom::RouteProvider, - mojom::AssociatedInterfaceProvider { + : public mojom::AssociatedInterfaceProvider { public: explicit LocalProvider(mojom::AssociatedInterfaceProviderAssociatedPtr* proxy) - : route_provider_binding_(this), - associated_interface_provider_binding_(this) { - route_provider_binding_.Bind(mojo::MakeRequest(&route_provider_ptr_)); - route_provider_ptr_->GetRoute( - 0, mojo::MakeRequest(proxy, route_provider_ptr_.associated_group())); + : associated_interface_provider_binding_(this) { + associated_interface_provider_binding_.Bind( + mojo::MakeRequestForTesting(proxy)); } ~LocalProvider() override {} @@ -29,14 +25,6 @@ } private: - // mojom::RouteProvider: - void GetRoute( - int32_t routing_id, - mojom::AssociatedInterfaceProviderAssociatedRequest request) override { - DCHECK(request.is_pending()); - associated_interface_provider_binding_.Bind(std::move(request)); - } - // mojom::AssociatedInterfaceProvider: void GetAssociatedInterface( const std::string& name, @@ -51,9 +39,6 @@ base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>>; BinderMap binders_; - mojom::RouteProviderPtr route_provider_ptr_; - mojo::Binding<mojom::RouteProvider> route_provider_binding_; - mojo::AssociatedBinding<mojom::AssociatedInterfaceProvider> associated_interface_provider_binding_; };
diff --git a/content/common/associated_interface_provider_impl.h b/content/common/associated_interface_provider_impl.h index 32670b2..bdfd02c 100644 --- a/content/common/associated_interface_provider_impl.h +++ b/content/common/associated_interface_provider_impl.h
@@ -2,6 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#ifndef CONTENT_COMMON_ASSOCIATED_INTERFACE_PROVIDER_IMPL_H_ +#define CONTENT_COMMON_ASSOCIATED_INTERFACE_PROVIDER_IMPL_H_ + #include "content/public/common/associated_interface_provider.h" #include <stdint.h> @@ -43,3 +46,5 @@ }; } // namespace content + +#endif // CONTENT_COMMON_ASSOCIATED_INTERFACE_PROVIDER_IMPL_H_
diff --git a/extensions/renderer/api_binding.cc b/extensions/renderer/api_binding.cc index bff8eba..163858d 100644 --- a/extensions/renderer/api_binding.cc +++ b/extensions/renderer/api_binding.cc
@@ -188,31 +188,43 @@ // GetCurrentContext() should always be correct. v8::Local<v8::Context> context = isolate->GetCurrentContext(); - // Check for a custom hook to handle the method. - if (binding_hooks_->HandleRequest(api_name_, name, context, - signature, arguments)) { - return; // Handled by a custom hook. + APIBindingHooks::RequestResult hooks_result = + APIBindingHooks::RequestResult::NOT_HANDLED; + hooks_result = binding_hooks_->HandleRequest(api_name_, name, context, + signature, arguments, + *type_refs_); + + switch (hooks_result) { + case APIBindingHooks::RequestResult::INVALID_INVOCATION: + arguments->ThrowTypeError("Invalid invocation"); + return; + case APIBindingHooks::RequestResult::HANDLED: + return; // Our work here is done. + case APIBindingHooks::RequestResult::NOT_HANDLED: + break; // Handle in the default manner. } - std::unique_ptr<base::ListValue> parsed_arguments; + std::unique_ptr<base::ListValue> converted_arguments; v8::Local<v8::Function> callback; + bool conversion_success = false; { v8::TryCatch try_catch(isolate); - parsed_arguments = - signature->ParseArguments(arguments, *type_refs_, &callback, &error); + conversion_success = signature->ParseArgumentsToJSON( + arguments, *type_refs_, &converted_arguments, &callback, &error); if (try_catch.HasCaught()) { - DCHECK(!parsed_arguments); + DCHECK(!converted_arguments); try_catch.ReThrow(); return; } } - if (!parsed_arguments) { + if (!conversion_success) { arguments->ThrowTypeError("Invalid invocation"); return; } - method_callback_.Run(name, std::move(parsed_arguments), isolate, - context, callback); + DCHECK(converted_arguments); + method_callback_.Run(name, std::move(converted_arguments), isolate, context, + callback); } } // namespace extensions
diff --git a/extensions/renderer/api_binding_hooks.cc b/extensions/renderer/api_binding_hooks.cc index 108a563..056fe30 100644 --- a/extensions/renderer/api_binding_hooks.cc +++ b/extensions/renderer/api_binding_hooks.cc
@@ -7,6 +7,7 @@ #include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "base/supports_user_data.h" +#include "extensions/renderer/api_signature.h" #include "gin/arguments.h" #include "gin/handle.h" #include "gin/object_template_builder.h" @@ -102,16 +103,22 @@ js_resource_name_ = std::move(resource_name); } -bool APIBindingHooks::HandleRequest(const std::string& api_name, - const std::string& method_name, - v8::Local<v8::Context> context, - const APISignature* signature, - gin::Arguments* arguments) { +APIBindingHooks::RequestResult APIBindingHooks::HandleRequest( + const std::string& api_name, + const std::string& method_name, + v8::Local<v8::Context> context, + const APISignature* signature, + gin::Arguments* arguments, + const ArgumentSpec::RefMap& type_refs) { // Easy case: a native custom hook. auto request_hooks_iter = request_hooks_.find(method_name); if (request_hooks_iter != request_hooks_.end()) { - request_hooks_iter->second.Run(signature, arguments); - return true; + RequestResult result = + request_hooks_iter->second.Run(signature, arguments, type_refs); + // Right now, it doesn't make sense to register a request handler that + // doesn't handle the request. + DCHECK_NE(RequestResult::NOT_HANDLED, result); + return result; } // Harder case: looking up a custom hook registered on the context (since @@ -121,11 +128,11 @@ APIHooksPerContextData* data = static_cast<APIHooksPerContextData*>( per_context_data->GetUserData(kExtensionAPIHooksPerContextKey)); if (!data) - return false; + return RequestResult::NOT_HANDLED; auto hook_interface_iter = data->hook_interfaces.find(api_name); if (hook_interface_iter == data->hook_interfaces.end()) - return false; + return RequestResult::NOT_HANDLED; JSHookInterface* hook_interface = nullptr; gin::Converter<JSHookInterface*>::FromV8( @@ -135,19 +142,21 @@ auto js_hook_iter = hook_interface->js_hooks()->find(method_name); if (js_hook_iter == hook_interface->js_hooks()->end()) - return false; + return RequestResult::NOT_HANDLED; // Found a JS handler. std::vector<v8::Local<v8::Value>> v8_args; + std::string error; + if (!signature->ParseArgumentsToV8(arguments, type_refs, &v8_args, &error)) + return RequestResult::INVALID_INVOCATION; + // TODO(devlin): Right now, this doesn't support exceptions or return values, // which we will need to at some point. - if (arguments->Length() == 0 || arguments->GetRemaining(&v8_args)) { - v8::Local<v8::Function> handler = - js_hook_iter->second.Get(context->GetIsolate()); - run_js_.Run(handler, context, v8_args.size(), v8_args.data()); - } + v8::Local<v8::Function> handler = + js_hook_iter->second.Get(context->GetIsolate()); + run_js_.Run(handler, context, v8_args.size(), v8_args.data()); - return true; + return RequestResult::HANDLED; } void APIBindingHooks::InitializeInContext(
diff --git a/extensions/renderer/api_binding_hooks.h b/extensions/renderer/api_binding_hooks.h index 9c74621..ffdd1686 100644 --- a/extensions/renderer/api_binding_hooks.h +++ b/extensions/renderer/api_binding_hooks.h
@@ -12,6 +12,7 @@ #include "base/callback.h" #include "base/macros.h" #include "extensions/renderer/api_binding_types.h" +#include "extensions/renderer/argument_spec.h" #include "v8/include/v8.h" namespace gin { @@ -28,6 +29,13 @@ // for registration of C++ handlers. Add JS support. class APIBindingHooks { public: + // The result of checking for hooks to handle a request. + enum class RequestResult { + HANDLED, // A custom hook handled the request. + INVALID_INVOCATION, // The request was called with invalid arguments. + NOT_HANDLED, // The request was not handled. + }; + // The callback to handle an API method. We pass in the expected signature // (so the caller can verify arguments, optionally after modifying/"massaging" // them) and the passed arguments. The handler is responsible for returning, @@ -37,7 +45,9 @@ // handlers to register a request so that they don't have to maintain a // reference to the callback themselves. using HandleRequestHook = - base::Callback<void(const APISignature*, gin::Arguments*)>; + base::Callback<RequestResult(const APISignature*, + gin::Arguments*, + const ArgumentSpec::RefMap&)>; explicit APIBindingHooks(const binding::RunJSFunction& run_js); ~APIBindingHooks(); @@ -56,12 +66,14 @@ const std::string& api_name); // Looks for a custom hook to handle the given request and, if one exists, - // runs it. Returns true if a hook was found and run. - bool HandleRequest(const std::string& api_name, - const std::string& method_name, - v8::Local<v8::Context> context, - const APISignature* signature, - gin::Arguments* arguments); + // runs it. Returns the result of trying to run the hook, or NOT_HANDLED if no + // hook was found. + RequestResult HandleRequest(const std::string& api_name, + const std::string& method_name, + v8::Local<v8::Context> context, + const APISignature* signature, + gin::Arguments* arguments, + const ArgumentSpec::RefMap& type_refs); // Returns a JS interface that can be used to register hooks. v8::Local<v8::Object> GetJSHookInterface(const std::string& api_name,
diff --git a/extensions/renderer/api_binding_unittest.cc b/extensions/renderer/api_binding_unittest.cc index 04c1806..114915c 100644 --- a/extensions/renderer/api_binding_unittest.cc +++ b/extensions/renderer/api_binding_unittest.cc
@@ -454,12 +454,14 @@ base::Bind(&RunFunctionOnGlobalAndIgnoreResult)); bool did_call = false; auto hook = [](bool* did_call, const APISignature* signature, - gin::Arguments* arguments) { + gin::Arguments* arguments, + const ArgumentSpec::RefMap& ref_map) { *did_call = true; EXPECT_EQ(1, arguments->Length()); std::string argument; EXPECT_TRUE(arguments->GetNext(&argument)); EXPECT_EQ("foo", argument); + return APIBindingHooks::RequestResult::HANDLED; }; hooks->RegisterHandleRequest("test.oneString", base::Bind(hook, &did_call)); @@ -525,8 +527,16 @@ v8::Local<v8::Object> binding_object = binding.CreateInstance( context, isolate(), &event_handler, base::Bind(&AllowAllAPIs)); - // First try calling the oneString() method, which has a custom hook - // installed. + // First try calling with an invalid invocation. An error should be raised and + // the hook should never have been called, since the arguments didn't match. + ExpectFailure(binding_object, "obj.oneString(1);", kError); + v8::Local<v8::Value> property = + GetPropertyFromObject(context->Global(), context, "requestArguments"); + ASSERT_FALSE(property.IsEmpty()); + EXPECT_TRUE(property->IsUndefined()); + + // Try calling the oneString() method with valid arguments. The hook should + // be called. v8::Local<v8::Function> func = FunctionFromString(context, "(function(obj) { obj.oneString('foo'); })"); v8::Local<v8::Value> args[] = {binding_object};
diff --git a/extensions/renderer/api_bindings_system_unittest.cc b/extensions/renderer/api_bindings_system_unittest.cc index 5a4ec225..65860387 100644 --- a/extensions/renderer/api_bindings_system_unittest.cc +++ b/extensions/renderer/api_bindings_system_unittest.cc
@@ -299,19 +299,25 @@ bool did_call = false; auto hook = [](bool* did_call, const APISignature* signature, - gin::Arguments* arguments) { + gin::Arguments* arguments, + const ArgumentSpec::RefMap& type_refs) { *did_call = true; std::string argument; EXPECT_EQ(2, arguments->Length()); EXPECT_TRUE(arguments->GetNext(&argument)); EXPECT_EQ("foo", argument); v8::Local<v8::Function> function; - ASSERT_TRUE(arguments->GetNext(&function)); + EXPECT_TRUE(arguments->GetNext(&function)); + // The above EXPECT_TRUE should really be an ASSERT, but that messes with + // the return type. + if (function.IsEmpty()) + return APIBindingHooks::RequestResult::HANDLED; v8::Local<v8::String> response = gin::StringToV8(arguments->isolate(), "bar"); v8::Local<v8::Value> response_args[] = {response}; RunFunctionOnGlobal(function, arguments->isolate()->GetCurrentContext(), 1, response_args); + return APIBindingHooks::RequestResult::HANDLED; }; APIBindingHooks* hooks = bindings_system()->GetHooksForAPI(kAlphaAPIName);
diff --git a/extensions/renderer/api_signature.cc b/extensions/renderer/api_signature.cc index 0edca2f9b..e919543 100644 --- a/extensions/renderer/api_signature.cc +++ b/extensions/renderer/api_signature.cc
@@ -10,6 +10,197 @@ namespace extensions { +namespace { + +// A class to help with argument parsing. Note that this uses v8::Locals and +// const&s because it's an implementation detail of the APISignature; this +// should *only* be used directly on the stack! +class ArgumentParser { + public: + ArgumentParser(const std::vector<std::unique_ptr<ArgumentSpec>>& signature, + gin::Arguments* arguments, + const ArgumentSpec::RefMap& type_refs, + std::string* error) + : context_(arguments->isolate()->GetCurrentContext()), + signature_(signature), + arguments_(arguments), + type_refs_(type_refs), + error_(error) {} + + // Tries to parse the arguments against the expected signature. + bool ParseArguments(); + + protected: + v8::Isolate* GetIsolate() { return context_->GetIsolate(); } + + private: + // Attempts to match the next argument to the given |spec|. + // If the next argument does not match and |spec| is optional, uses a null + // value. + // Returns true on success. + bool ParseArgument(const ArgumentSpec& spec); + + // Attempts to parse the callback from the given |spec|. Returns true on + // success. + bool ParseCallback(const ArgumentSpec& spec); + + // Adds a null value to the parsed arguments. + virtual void AddNull() = 0; + // Returns a base::Value to be populated during argument matching. + virtual std::unique_ptr<base::Value>* GetBuffer() = 0; + // Adds a new parsed argument. + virtual void AddParsedArgument(v8::Local<v8::Value> value) = 0; + // Adds the parsed callback. + virtual void SetCallback(v8::Local<v8::Function> callback) = 0; + + v8::Local<v8::Context> context_; + const std::vector<std::unique_ptr<ArgumentSpec>>& signature_; + gin::Arguments* arguments_; + const ArgumentSpec::RefMap& type_refs_; + std::string* error_; + + DISALLOW_COPY_AND_ASSIGN(ArgumentParser); +}; + +class V8ArgumentParser : public ArgumentParser { + public: + V8ArgumentParser(const std::vector<std::unique_ptr<ArgumentSpec>>& signature, + gin::Arguments* arguments, + const ArgumentSpec::RefMap& type_refs, + std::string* error, + std::vector<v8::Local<v8::Value>>* values) + : ArgumentParser(signature, arguments, type_refs, error), + values_(values) {} + + private: + void AddNull() override { values_->push_back(v8::Null(GetIsolate())); } + std::unique_ptr<base::Value>* GetBuffer() override { return nullptr; } + void AddParsedArgument(v8::Local<v8::Value> value) override { + values_->push_back(value); + } + void SetCallback(v8::Local<v8::Function> callback) override { + values_->push_back(callback); + } + + std::vector<v8::Local<v8::Value>>* values_; + + DISALLOW_COPY_AND_ASSIGN(V8ArgumentParser); +}; + +class BaseValueArgumentParser : public ArgumentParser { + public: + BaseValueArgumentParser( + const std::vector<std::unique_ptr<ArgumentSpec>>& signature, + gin::Arguments* arguments, + const ArgumentSpec::RefMap& type_refs, + std::string* error, + base::ListValue* list_value) + : ArgumentParser(signature, arguments, type_refs, error), + list_value_(list_value) {} + + v8::Local<v8::Function> callback() { return callback_; } + + private: + void AddNull() override { + list_value_->Append(base::Value::CreateNullValue()); + } + std::unique_ptr<base::Value>* GetBuffer() override { return &last_arg_; } + void AddParsedArgument(v8::Local<v8::Value> value) override { + // The corresponding base::Value is expected to have been stored in + // |last_arg_| already. + DCHECK(last_arg_); + list_value_->Append(std::move(last_arg_)); + last_arg_.reset(); + } + void SetCallback(v8::Local<v8::Function> callback) override { + callback_ = callback; + } + + base::ListValue* list_value_; + std::unique_ptr<base::Value> last_arg_; + v8::Local<v8::Function> callback_; + + DISALLOW_COPY_AND_ASSIGN(BaseValueArgumentParser); +}; + +bool ArgumentParser::ParseArguments() { + // TODO(devlin): This is how extension APIs have always determined if a + // function has a callback, but it seems a little silly. In the long run (once + // signatures are generated), it probably makes sense to indicate this + // differently. + bool signature_has_callback = + !signature_.empty() && + signature_.back()->type() == ArgumentType::FUNCTION; + + size_t end_size = + signature_has_callback ? signature_.size() - 1 : signature_.size(); + for (size_t i = 0; i < end_size; ++i) { + if (!ParseArgument(*signature_[i])) + return false; + } + + if (signature_has_callback && !ParseCallback(*signature_.back())) + return false; + + if (!arguments_->PeekNext().IsEmpty()) + return false; // Extra arguments aren't allowed. + + return true; +} + +bool ArgumentParser::ParseArgument(const ArgumentSpec& spec) { + v8::Local<v8::Value> value = arguments_->PeekNext(); + if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) { + if (!spec.optional()) { + *error_ = "Missing required argument: " + spec.name(); + return false; + } + // This is safe to call even if |arguments| is at the end (which can happen + // if n optional arguments are omitted at the end of the signature). + arguments_->Skip(); + + AddNull(); + return true; + } + + if (!spec.ParseArgument(context_, value, type_refs_, GetBuffer(), error_)) { + if (!spec.optional()) { + *error_ = "Missing required argument: " + spec.name(); + return false; + } + + AddNull(); + return true; + } + + arguments_->Skip(); + AddParsedArgument(value); + return true; +} + +bool ArgumentParser::ParseCallback(const ArgumentSpec& spec) { + v8::Local<v8::Value> value = arguments_->PeekNext(); + if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) { + if (!spec.optional()) { + *error_ = "Missing required argument: " + spec.name(); + return false; + } + arguments_->Skip(); + return true; + } + + if (!value->IsFunction()) { + *error_ = "Argument is wrong type: " + spec.name(); + return false; + } + + arguments_->Skip(); + SetCallback(value.As<v8::Function>()); + return true; +} + +} // namespace + APISignature::APISignature(const base::ListValue& specification) { signature_.reserve(specification.GetSize()); for (const auto& value : specification) { @@ -21,99 +212,34 @@ APISignature::~APISignature() {} -std::unique_ptr<base::ListValue> APISignature::ParseArguments( +bool APISignature::ParseArgumentsToV8(gin::Arguments* arguments, + const ArgumentSpec::RefMap& type_refs, + std::vector<v8::Local<v8::Value>>* v8_out, + std::string* error) const { + DCHECK(v8_out); + std::vector<v8::Local<v8::Value>> v8_values; + V8ArgumentParser parser(signature_, arguments, type_refs, error, &v8_values); + if (!parser.ParseArguments()) + return false; + *v8_out = std::move(v8_values); + return true; +} + +bool APISignature::ParseArgumentsToJSON( gin::Arguments* arguments, const ArgumentSpec::RefMap& type_refs, + std::unique_ptr<base::ListValue>* json_out, v8::Local<v8::Function>* callback_out, std::string* error) const { - auto results = base::MakeUnique<base::ListValue>(); - - // TODO(devlin): This is how extension APIs have always determined if a - // function has a callback, but it seems a little silly. In the long run (once - // signatures are generated), it probably makes sense to indicate this - // differently. - bool signature_has_callback = - !signature_.empty() && - signature_.back()->type() == ArgumentType::FUNCTION; - - v8::Local<v8::Context> context = arguments->isolate()->GetCurrentContext(); - - size_t end_size = - signature_has_callback ? signature_.size() - 1 : signature_.size(); - for (size_t i = 0; i < end_size; ++i) { - std::unique_ptr<base::Value> parsed = - ParseArgument(*signature_[i], context, arguments, type_refs, error); - if (!parsed) - return nullptr; - results->Append(std::move(parsed)); - } - - v8::Local<v8::Function> callback_value; - if (signature_has_callback && - !ParseCallback(arguments, *signature_.back(), error, &callback_value)) { - return nullptr; - } - - if (!arguments->PeekNext().IsEmpty()) - return nullptr; // Extra arguments aren't allowed. - - *callback_out = callback_value; - return results; -} - -std::unique_ptr<base::Value> APISignature::ParseArgument( - const ArgumentSpec& spec, - v8::Local<v8::Context> context, - gin::Arguments* arguments, - const ArgumentSpec::RefMap& type_refs, - std::string* error) const { - v8::Local<v8::Value> value = arguments->PeekNext(); - if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) { - if (!spec.optional()) { - *error = "Missing required argument: " + spec.name(); - return nullptr; - } - // This is safe to call even if |arguments| is at the end (which can happen - // if n optional arguments are omitted at the end of the signature). - arguments->Skip(); - return base::Value::CreateNullValue(); - } - - std::unique_ptr<base::Value> result = - spec.ConvertArgument(context, value, type_refs, error); - if (!result) { - if (!spec.optional()) { - *error = "Missing required argument: " + spec.name(); - return nullptr; - } - return base::Value::CreateNullValue(); - } - - arguments->Skip(); - return result; -} - -bool APISignature::ParseCallback(gin::Arguments* arguments, - const ArgumentSpec& callback_spec, - std::string* error, - v8::Local<v8::Function>* callback_out) const { - v8::Local<v8::Value> value = arguments->PeekNext(); - if (value.IsEmpty() || value->IsNull() || value->IsUndefined()) { - if (!callback_spec.optional()) { - *error = "Missing required argument: " + callback_spec.name(); - return false; - } - arguments->Skip(); - return true; - } - - if (!value->IsFunction()) { - *error = "Argument is wrong type: " + callback_spec.name(); + DCHECK(json_out); + DCHECK(callback_out); + std::unique_ptr<base::ListValue> json = base::MakeUnique<base::ListValue>(); + BaseValueArgumentParser parser( + signature_, arguments, type_refs, error, json.get()); + if (!parser.ParseArguments()) return false; - } - - *callback_out = value.As<v8::Function>(); - arguments->Skip(); + *json_out = std::move(json); + *callback_out = parser.callback(); return true; }
diff --git a/extensions/renderer/api_signature.h b/extensions/renderer/api_signature.h index c2f3ab8..0e1451d 100644 --- a/extensions/renderer/api_signature.h +++ b/extensions/renderer/api_signature.h
@@ -30,37 +30,27 @@ APISignature(const base::ListValue& specification); ~APISignature(); + // Parses |arguments| against this signature, and populates |args_out| with + // the v8 values (performing no conversion). The resulting vector may differ + // from the list of arguments passed in because it will include null-filled + // optional arguments. + // Returns true if the arguments were successfully parsed and converted. + bool ParseArgumentsToV8(gin::Arguments* arguments, + const ArgumentSpec::RefMap& type_refs, + std::vector<v8::Local<v8::Value>>* args_out, + std::string* error) const; + // Parses |arguments| against this signature, converting to a base::ListValue. - // If the arguments don't match, null is returned and |error| is populated. - std::unique_ptr<base::ListValue> ParseArguments( - gin::Arguments* arguments, - const ArgumentSpec::RefMap& type_refs, - v8::Local<v8::Function>* callback_out, - std::string* error) const; + // Returns true if the arguments were successfully parsed and converted, and + // populates |args_out| and |callback_out| with the JSON arguments and + // callback values, respectively. On failure, returns false populates |error|. + bool ParseArgumentsToJSON(gin::Arguments* arguments, + const ArgumentSpec::RefMap& type_refs, + std::unique_ptr<base::ListValue>* args_out, + v8::Local<v8::Function>* callback_out, + std::string* error) const; private: - // Attempts to match an argument from |arguments| to the given |spec|. - // If the next argmument does not match and |spec| is optional, a null - // base::Value is returned. - // If the argument matches, |arguments| is advanced and the converted value is - // returned. - // If the argument does not match and it is not optional, returns null and - // populates error. - std::unique_ptr<base::Value> ParseArgument( - const ArgumentSpec& spec, - v8::Local<v8::Context> context, - gin::Arguments* arguments, - const ArgumentSpec::RefMap& type_refs, - std::string* error) const; - - // Parses the callback from |arguments| according to |callback_spec|. Since - // the callback isn't converted into a base::Value, this is different from - // ParseArgument() above. - bool ParseCallback(gin::Arguments* arguments, - const ArgumentSpec& callback_spec, - std::string* error, - v8::Local<v8::Function>* callback_out) const; - // The list of expected arguments. std::vector<std::unique_ptr<ArgumentSpec>> signature_;
diff --git a/extensions/renderer/argument_spec.cc b/extensions/renderer/argument_spec.cc index e13ff07b..53d882b 100644 --- a/extensions/renderer/argument_spec.cc +++ b/extensions/renderer/argument_spec.cc
@@ -15,16 +15,18 @@ namespace { template <class T> -std::unique_ptr<base::Value> GetFundamentalConvertedValueHelper( - v8::Local<v8::Value> arg, - v8::Local<v8::Context> context, - const base::Optional<int>& minimum) { +bool ParseFundamentalValueHelper(v8::Local<v8::Value> arg, + v8::Local<v8::Context> context, + const base::Optional<int>& minimum, + std::unique_ptr<base::Value>* out_value) { T val; if (!gin::Converter<T>::FromV8(context->GetIsolate(), arg, &val)) - return nullptr; + return false; if (minimum && val < minimum.value()) - return nullptr; - return base::MakeUnique<base::FundamentalValue>(val); + return false; + if (out_value) + *out_value = base::MakeUnique<base::FundamentalValue>(val); + return true; } } // namespace @@ -120,55 +122,57 @@ ArgumentSpec::~ArgumentSpec() {} -std::unique_ptr<base::Value> ArgumentSpec::ConvertArgument( - v8::Local<v8::Context> context, - v8::Local<v8::Value> value, - const RefMap& refs, - std::string* error) const { - // TODO(devlin): Support functions? - DCHECK_NE(type_, ArgumentType::FUNCTION); +bool ArgumentSpec::ParseArgument(v8::Local<v8::Context> context, + v8::Local<v8::Value> value, + const RefMap& refs, + std::unique_ptr<base::Value>* out_value, + std::string* error) const { + if (type_ == ArgumentType::FUNCTION) { + // We can't serialize functions. We shouldn't be asked to. + DCHECK(!out_value); + return value->IsFunction(); + } + if (type_ == ArgumentType::REF) { DCHECK(ref_); auto iter = refs.find(ref_.value()); DCHECK(iter != refs.end()) << ref_.value(); - return iter->second->ConvertArgument(context, value, refs, error); + return iter->second->ParseArgument(context, value, refs, out_value, error); } if (type_ == ArgumentType::CHOICES) { for (const auto& choice : choices_) { - std::unique_ptr<base::Value> result = - choice->ConvertArgument(context, value, refs, error); - if (result) - return result; + if (choice->ParseArgument(context, value, refs, out_value, error)) + return true; } *error = "Did not match any of the choices"; - return nullptr; + return false; } if (IsFundamentalType()) - return ConvertArgumentToFundamental(context, value, error); + return ParseArgumentToFundamental(context, value, out_value, error); if (type_ == ArgumentType::OBJECT) { // TODO(devlin): Currently, this would accept an array (if that array had // all the requisite properties). Is that the right thing to do? if (!value->IsObject()) { *error = "Wrong type"; - return nullptr; + return false; } v8::Local<v8::Object> object = value.As<v8::Object>(); - return ConvertArgumentToObject(context, object, refs, error); + return ParseArgumentToObject(context, object, refs, out_value, error); } if (type_ == ArgumentType::LIST) { if (!value->IsArray()) { *error = "Wrong type"; - return nullptr; + return false; } v8::Local<v8::Array> array = value.As<v8::Array>(); - return ConvertArgumentToArray(context, array, refs, error); + return ParseArgumentToArray(context, array, refs, out_value, error); } if (type_ == ArgumentType::ANY) - return ConvertArgumentToAny(context, value, error); + return ParseArgumentToAny(context, value, out_value, error); NOTREACHED(); - return nullptr; + return false; } bool ArgumentSpec::IsFundamentalType() const { @@ -176,54 +180,70 @@ type_ == ArgumentType::BOOLEAN || type_ == ArgumentType::STRING; } -std::unique_ptr<base::Value> ArgumentSpec::ConvertArgumentToFundamental( +bool ArgumentSpec::ParseArgumentToFundamental( v8::Local<v8::Context> context, v8::Local<v8::Value> value, + std::unique_ptr<base::Value>* out_value, std::string* error) const { DCHECK(IsFundamentalType()); switch (type_) { case ArgumentType::INTEGER: - return GetFundamentalConvertedValueHelper<int32_t>(value, context, - minimum_); + return ParseFundamentalValueHelper<int32_t>(value, context, minimum_, + out_value); case ArgumentType::DOUBLE: - return GetFundamentalConvertedValueHelper<double>(value, context, - minimum_); + return ParseFundamentalValueHelper<double>(value, context, minimum_, + out_value); case ArgumentType::STRING: { + if (!value->IsString()) + return false; + // If we don't need to match enum values and don't need to convert, we're + // done... + if (!out_value && enum_values_.empty()) + return true; + // ...Otherwise, we need to convert to a std::string. std::string s; - // TODO(devlin): If base::StringValue ever takes a std::string&&, we could - // use std::move to construct. - if (!gin::Converter<std::string>::FromV8(context->GetIsolate(), - value, &s) || - (!enum_values_.empty() && enum_values_.count(s) == 0)) { - return nullptr; + // We already checked that this is a string, so this should never fail. + CHECK(gin::Converter<std::string>::FromV8(context->GetIsolate(), value, + &s)); + if (!enum_values_.empty() && enum_values_.count(s) == 0) + return false; + if (out_value) { + // TODO(devlin): If base::StringValue ever takes a std::string&&, we + // could use std::move to construct. + *out_value = base::MakeUnique<base::StringValue>(s); } - return base::MakeUnique<base::StringValue>(s); + return true; } case ArgumentType::BOOLEAN: { - bool b = false; - if (value->IsBoolean() && - gin::Converter<bool>::FromV8(context->GetIsolate(), value, &b)) { - return base::MakeUnique<base::FundamentalValue>(b); + if (!value->IsBoolean()) + return false; + if (out_value) { + *out_value = base::MakeUnique<base::FundamentalValue>( + value.As<v8::Boolean>()->Value()); } - return nullptr; + return true; } default: NOTREACHED(); } - return nullptr; + return false; } -std::unique_ptr<base::Value> ArgumentSpec::ConvertArgumentToObject( +bool ArgumentSpec::ParseArgumentToObject( v8::Local<v8::Context> context, v8::Local<v8::Object> object, const RefMap& refs, + std::unique_ptr<base::Value>* out_value, std::string* error) const { DCHECK_EQ(ArgumentType::OBJECT, type_); - auto result = base::MakeUnique<base::DictionaryValue>(); + std::unique_ptr<base::DictionaryValue> result; + // Only construct the result if we have an |out_value| to populate. + if (out_value) + result = base::MakeUnique<base::DictionaryValue>(); gin::Dictionary dictionary(context->GetIsolate(), object); for (const auto& kv : properties_) { v8::Local<v8::Value> subvalue; - // See comment in ConvertArgumentToArray() about passing in custom crazy + // See comment in ParseArgumentToArray() about passing in custom crazy // values here. // TODO(devlin): gin::Dictionary::Get() uses Isolate::GetCurrentContext() - // is that always right here, or should we use the v8::Object APIs and @@ -232,31 +252,38 @@ // v8::String for each call. Hypothetically, we could cache these, or at // least use an internalized string. if (!dictionary.Get(kv.first, &subvalue)) - return nullptr; + return false; if (subvalue.IsEmpty() || subvalue->IsNull() || subvalue->IsUndefined()) { if (!kv.second->optional_) { *error = "Missing key: " + kv.first; - return nullptr; + return false; } continue; } - std::unique_ptr<base::Value> property = - kv.second->ConvertArgument(context, subvalue, refs, error); - if (!property) - return nullptr; - result->Set(kv.first, std::move(property)); + std::unique_ptr<base::Value> property; + if (!kv.second->ParseArgument(context, subvalue, refs, + out_value ? &property : nullptr, error)) { + return false; + } + if (result) + result->Set(kv.first, std::move(property)); } - return std::move(result); + if (out_value) + *out_value = std::move(result); + return true; } -std::unique_ptr<base::Value> ArgumentSpec::ConvertArgumentToArray( - v8::Local<v8::Context> context, - v8::Local<v8::Array> value, - const RefMap& refs, - std::string* error) const { +bool ArgumentSpec::ParseArgumentToArray(v8::Local<v8::Context> context, + v8::Local<v8::Array> value, + const RefMap& refs, + std::unique_ptr<base::Value>* out_value, + std::string* error) const { DCHECK_EQ(ArgumentType::LIST, type_); - auto result = base::MakeUnique<base::ListValue>(); + std::unique_ptr<base::ListValue> result; + // Only construct the result if we have an |out_value| to populate. + if (out_value) + result = base::MakeUnique<base::ListValue>(); uint32_t length = value->Length(); for (uint32_t i = 0; i < length; ++i) { v8::MaybeLocal<v8::Value> maybe_subvalue = value->Get(context, i); @@ -269,28 +296,37 @@ // TODO(devlin): This is probably fine, but it's worth contemplating // catching the error and throwing our own. if (!maybe_subvalue.ToLocal(&subvalue)) - return nullptr; - std::unique_ptr<base::Value> item = - list_element_type_->ConvertArgument(context, subvalue, refs, error); - if (!item) - return nullptr; - result->Append(std::move(item)); + return false; + std::unique_ptr<base::Value> item; + if (!list_element_type_->ParseArgument(context, subvalue, refs, + result ? &item : nullptr, error)) { + return false; + } + if (result) + result->Append(std::move(item)); } - return std::move(result); + if (out_value) + *out_value = std::move(result); + return true; } -std::unique_ptr<base::Value> ArgumentSpec::ConvertArgumentToAny( - v8::Local<v8::Context> context, - v8::Local<v8::Value> value, - std::string* error) const { +bool ArgumentSpec::ParseArgumentToAny(v8::Local<v8::Context> context, + v8::Local<v8::Value> value, + std::unique_ptr<base::Value>* out_value, + std::string* error) const { DCHECK_EQ(ArgumentType::ANY, type_); - std::unique_ptr<content::V8ValueConverter> converter( - content::V8ValueConverter::create()); - std::unique_ptr<base::Value> converted( - converter->FromV8Value(value, context)); - if (!converted) - *error = "Could not convert to 'any'."; - return converted; + if (out_value) { + std::unique_ptr<content::V8ValueConverter> converter( + content::V8ValueConverter::create()); + std::unique_ptr<base::Value> converted( + converter->FromV8Value(value, context)); + if (!converted) { + *error = "Could not convert to 'any'."; + return false; + } + *out_value = std::move(converted); + } + return true; } } // namespace extensions
diff --git a/extensions/renderer/argument_spec.h b/extensions/renderer/argument_spec.h index 50a22dc..6a1df6c 100644 --- a/extensions/renderer/argument_spec.h +++ b/extensions/renderer/argument_spec.h
@@ -48,12 +48,14 @@ explicit ArgumentSpec(const base::Value& value); ~ArgumentSpec(); - // Returns the converted base::Value or null if the |value| didn't match. - std::unique_ptr<base::Value> ConvertArgument( - v8::Local<v8::Context> context, - v8::Local<v8::Value> value, - const RefMap& refs, - std::string* error) const; + // Returns true if the passed |value| matches this specification. If + // |out_value| is non-null, converts the value to a base::Value and populates + // |out_value|. Otherwise, no conversion is performed. + bool ParseArgument(v8::Local<v8::Context> context, + v8::Local<v8::Value> value, + const RefMap& refs, + std::unique_ptr<base::Value>* out_value, + std::string* error) const; const std::string& name() const { return name_; } bool optional() const { return optional_; } @@ -68,24 +70,24 @@ // Conversion functions. These should only be used if the spec is of the given // type (otherwise, they will DCHECK). - std::unique_ptr<base::Value> ConvertArgumentToFundamental( - v8::Local<v8::Context> context, - v8::Local<v8::Value> value, - std::string* error) const; - std::unique_ptr<base::Value> ConvertArgumentToObject( - v8::Local<v8::Context> context, - v8::Local<v8::Object> object, - const RefMap& refs, - std::string* error) const; - std::unique_ptr<base::Value> ConvertArgumentToArray( - v8::Local<v8::Context> context, - v8::Local<v8::Array> value, - const RefMap& refs, - std::string* error) const; - std::unique_ptr<base::Value> ConvertArgumentToAny( - v8::Local<v8::Context> context, - v8::Local<v8::Value> value, - std::string* error) const; + bool ParseArgumentToFundamental(v8::Local<v8::Context> context, + v8::Local<v8::Value> value, + std::unique_ptr<base::Value>* out_value, + std::string* error) const; + bool ParseArgumentToObject(v8::Local<v8::Context> context, + v8::Local<v8::Object> object, + const RefMap& refs, + std::unique_ptr<base::Value>* out_value, + std::string* error) const; + bool ParseArgumentToArray(v8::Local<v8::Context> context, + v8::Local<v8::Array> value, + const RefMap& refs, + std::unique_ptr<base::Value>* out_value, + std::string* error) const; + bool ParseArgumentToAny(v8::Local<v8::Context> context, + v8::Local<v8::Value> value, + std::unique_ptr<base::Value>* out_value, + std::string* error) const; // The name of the argument. std::string name_;
diff --git a/extensions/renderer/argument_spec_unittest.cc b/extensions/renderer/argument_spec_unittest.cc index ac4d152..12a8c61 100644 --- a/extensions/renderer/argument_spec_unittest.cc +++ b/extensions/renderer/argument_spec_unittest.cc
@@ -21,20 +21,32 @@ void ExpectSuccess(const ArgumentSpec& spec, const std::string& script_source, const std::string& expected_json_single_quotes) { - RunTest(spec, script_source, TestResult::PASS, + RunTest(spec, script_source, true, TestResult::PASS, ReplaceSingleQuotes(expected_json_single_quotes), std::string()); } + void ExpectSuccessWithNoConversion(const ArgumentSpec& spec, + const std::string& script_source) { + RunTest(spec, script_source, false, TestResult::PASS, + std::string(), std::string()); + } + void ExpectFailure(const ArgumentSpec& spec, const std::string& script_source) { - RunTest(spec, script_source, TestResult::FAIL, std::string(), + RunTest(spec, script_source, true, TestResult::FAIL, std::string(), + std::string()); + } + + void ExpectFailureWithNoConversion(const ArgumentSpec& spec, + const std::string& script_source) { + RunTest(spec, script_source, false, TestResult::FAIL, std::string(), std::string()); } void ExpectThrow(const ArgumentSpec& spec, const std::string& script_source, const std::string& expected_thrown_message) { - RunTest(spec, script_source, TestResult::THROW, std::string(), + RunTest(spec, script_source, true, TestResult::THROW, std::string(), expected_thrown_message); } @@ -47,6 +59,7 @@ void RunTest(const ArgumentSpec& spec, const std::string& script_source, + bool should_convert, TestResult expected_result, const std::string& expected_json, const std::string& expected_thrown_message); @@ -58,6 +71,7 @@ void ArgumentSpecUnitTest::RunTest(const ArgumentSpec& spec, const std::string& script_source, + bool should_convert, TestResult expected_result, const std::string& expected_json, const std::string& expected_thrown_message) { @@ -71,13 +85,16 @@ ASSERT_FALSE(val.IsEmpty()) << script_source; std::string error; - std::unique_ptr<base::Value> out_value = - spec.ConvertArgument(context, val, type_refs_, &error); + std::unique_ptr<base::Value> out_value; + bool did_succeed = + spec.ParseArgument(context, val, type_refs_, + should_convert ? &out_value : nullptr, &error); bool should_succeed = expected_result == TestResult::PASS; - ASSERT_EQ(should_succeed, !!out_value) << script_source << ", " << error; + ASSERT_EQ(should_succeed, did_succeed) << script_source << ", " << error; + ASSERT_EQ(did_succeed && should_convert, !!out_value); bool should_throw = expected_result == TestResult::THROW; ASSERT_EQ(should_throw, try_catch.HasCaught()) << script_source; - if (should_succeed) { + if (should_succeed && should_convert) { ASSERT_TRUE(out_value); EXPECT_EQ(expected_json, ValueToString(*out_value)); } else if (should_throw) { @@ -217,11 +234,13 @@ { const char kFunctionSpec[] = "{ 'type': 'function' }"; - // We don't allow conversion of functions (converting to a base::Value is - // impossible), but we should still be able to parse a function - // specification. ArgumentSpec spec(*ValueFromString(kFunctionSpec)); - EXPECT_EQ(ArgumentType::FUNCTION, spec.type()); + ExpectSuccessWithNoConversion(spec, "(function() {})"); + ExpectSuccessWithNoConversion(spec, "(function(a, b) { a(); b(); })"); + ExpectSuccessWithNoConversion(spec, "(function(a, b) { a(); b(); })"); + ExpectFailureWithNoConversion(spec, "({a: function() {}})"); + ExpectFailureWithNoConversion(spec, "([function() {}])"); + ExpectFailureWithNoConversion(spec, "1"); } }
diff --git a/media/base/cdm_promise_adapter.cc b/media/base/cdm_promise_adapter.cc index de380e0a..a74c95a 100644 --- a/media/base/cdm_promise_adapter.cc +++ b/media/base/cdm_promise_adapter.cc
@@ -20,7 +20,7 @@ uint32_t CdmPromiseAdapter::SavePromise(std::unique_ptr<CdmPromise> promise) { DCHECK(thread_checker_.CalledOnValidThread()); uint32_t promise_id = next_promise_id_++; - promises_.add(promise_id, std::move(promise)); + promises_[promise_id] = std::move(promise); return promise_id; } @@ -71,7 +71,9 @@ PromiseMap::iterator it = promises_.find(promise_id); if (it == promises_.end()) return nullptr; - return promises_.take_and_erase(it); + std::unique_ptr<CdmPromise> result = std::move(it->second); + promises_.erase(it); + return result; } // Explicit instantiation of function templates.
diff --git a/media/base/cdm_promise_adapter.h b/media/base/cdm_promise_adapter.h index 805d0c3..efe3e86a 100644 --- a/media/base/cdm_promise_adapter.h +++ b/media/base/cdm_promise_adapter.h
@@ -8,8 +8,8 @@ #include <stdint.h> #include <memory> +#include <unordered_map> -#include "base/containers/scoped_ptr_hash_map.h" #include "base/macros.h" #include "base/threading/thread_checker.h" #include "media/base/cdm_promise.h" @@ -44,9 +44,8 @@ void Clear(); private: - // A map between promise IDs and CdmPromises. It owns the CdmPromises. - typedef base::ScopedPtrHashMap<uint32_t, std::unique_ptr<CdmPromise>> - PromiseMap; + // A map between promise IDs and CdmPromises. + using PromiseMap = std::unordered_map<uint32_t, std::unique_ptr<CdmPromise>>; // Finds, takes the ownership of and returns the promise for |promise_id|. // Returns null if no promise can be found.
diff --git a/media/blink/webencryptedmediaclient_impl.cc b/media/blink/webencryptedmediaclient_impl.cc index 3584f6ce..9dd3c26 100644 --- a/media/blink/webencryptedmediaclient_impl.cc +++ b/media/blink/webencryptedmediaclient_impl.cc
@@ -173,12 +173,10 @@ // Return a per-frame singleton so that UMA reports will be once-per-frame. std::string uma_name = GetKeySystemNameForUMA(key_system_ascii); - Reporter* reporter = reporters_.get(uma_name); - if (!reporter) { - reporter = new Reporter(uma_name); - reporters_.add(uma_name, base::WrapUnique(reporter)); - } - return reporter; + std::unique_ptr<Reporter>& reporter = reporters_[uma_name]; + if (!reporter) + reporter = base::MakeUnique<Reporter>(uma_name); + return reporter.get(); } } // namespace media
diff --git a/media/blink/webencryptedmediaclient_impl.h b/media/blink/webencryptedmediaclient_impl.h index 28e19544..3bb9105 100644 --- a/media/blink/webencryptedmediaclient_impl.h +++ b/media/blink/webencryptedmediaclient_impl.h
@@ -7,9 +7,9 @@ #include <memory> #include <string> +#include <unordered_map> #include "base/callback.h" -#include "base/containers/scoped_ptr_hash_map.h" #include "base/memory/weak_ptr.h" #include "media/blink/key_system_config_selector.h" #include "media/blink/media_blink_export.h" @@ -73,7 +73,7 @@ Reporter* GetReporter(const blink::WebString& key_system); // Reporter singletons. - base::ScopedPtrHashMap<std::string, std::unique_ptr<Reporter>> reporters_; + std::unordered_map<std::string, std::unique_ptr<Reporter>> reporters_; base::Callback<bool(void)> are_secure_codecs_supported_cb_; CdmFactory* cdm_factory_;
diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc index 3f41e29..919a54e 100644 --- a/media/cdm/aes_decryptor.cc +++ b/media/cdm/aes_decryptor.cc
@@ -561,7 +561,7 @@ std::unique_ptr<SessionIdDecryptionKeyMap> inner_map( new SessionIdDecryptionKeyMap()); inner_map->Insert(session_id, std::move(decryption_key)); - key_map_.add(key_id, std::move(inner_map)); + key_map_[key_id] = std::move(inner_map); return true; }
diff --git a/media/cdm/aes_decryptor.h b/media/cdm/aes_decryptor.h index 973ec2c..bc9d990 100644 --- a/media/cdm/aes_decryptor.h +++ b/media/cdm/aes_decryptor.h
@@ -10,9 +10,9 @@ #include <memory> #include <set> #include <string> +#include <unordered_map> #include <vector> -#include "base/containers/scoped_ptr_hash_map.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" @@ -113,9 +113,9 @@ class SessionIdDecryptionKeyMap; // Key ID <-> SessionIdDecryptionKeyMap map. - typedef base::ScopedPtrHashMap<std::string, - std::unique_ptr<SessionIdDecryptionKeyMap>> - KeyIdToSessionKeysMap; + using KeyIdToSessionKeysMap = + std::unordered_map<std::string, + std::unique_ptr<SessionIdDecryptionKeyMap>>; ~AesDecryptor() override;
diff --git a/media/gpu/ipc/service/media_gpu_channel_manager.cc b/media/gpu/ipc/service/media_gpu_channel_manager.cc index 568723a..684c05a 100644 --- a/media/gpu/ipc/service/media_gpu_channel_manager.cc +++ b/media/gpu/ipc/service/media_gpu_channel_manager.cc
@@ -29,7 +29,7 @@ std::unique_ptr<MediaGpuChannel> media_gpu_channel( new MediaGpuChannel(gpu_channel)); gpu_channel->SetUnhandledMessageListener(media_gpu_channel.get()); - media_gpu_channels_.set(client_id, std::move(media_gpu_channel)); + media_gpu_channels_[client_id] = std::move(media_gpu_channel); } void MediaGpuChannelManager::RemoveChannel(int32_t client_id) {
diff --git a/media/gpu/ipc/service/media_gpu_channel_manager.h b/media/gpu/ipc/service/media_gpu_channel_manager.h index a89727c..01aa42e 100644 --- a/media/gpu/ipc/service/media_gpu_channel_manager.h +++ b/media/gpu/ipc/service/media_gpu_channel_manager.h
@@ -8,8 +8,8 @@ #include <stdint.h> #include <memory> +#include <unordered_map> -#include "base/containers/scoped_ptr_hash_map.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "ipc/ipc_listener.h" @@ -36,7 +36,7 @@ private: gpu::GpuChannelManager* const channel_manager_; - base::ScopedPtrHashMap<int32_t, std::unique_ptr<MediaGpuChannel>> + std::unordered_map<int32_t, std::unique_ptr<MediaGpuChannel>> media_gpu_channels_; DISALLOW_COPY_AND_ASSIGN(MediaGpuChannelManager); };
diff --git a/net/base/net_error_list.h b/net/base/net_error_list.h index 8c79551..9720575 100644 --- a/net/base/net_error_list.h +++ b/net/base/net_error_list.h
@@ -324,8 +324,7 @@ // Error -157 was removed (SSL_INAPPROPRIATE_FALLBACK). -// Certificate Transparency: All Signed Certificate Timestamps failed to verify. -NET_ERROR(CT_NO_SCTS_VERIFIED_OK, -158) +// Error -158 was removed (CT_NO_SCTS_VERIFIED_OK). // The SSL server sent us a fatal unrecognized_name alert. NET_ERROR(SSL_UNRECOGNIZED_NAME_ALERT, -159)
diff --git a/net/cert/ct_objects_extractor.cc b/net/cert/ct_objects_extractor.cc index 4f451fd..1a6e6e4 100644 --- a/net/cert/ct_objects_extractor.cc +++ b/net/cert/ct_objects_extractor.cc
@@ -252,7 +252,7 @@ bool ExtractSCTListFromOCSPResponse(X509Certificate::OSCertHandle issuer, const std::string& cert_serial_number, - const std::string& ocsp_response, + base::StringPiece ocsp_response, std::string* sct_list) { // The input is an OCSPResponse. See RFC2560, section 4.2.1. The SCT list is // in the extensions field of the SingleResponse which matches the input
diff --git a/net/cert/ct_objects_extractor.h b/net/cert/ct_objects_extractor.h index d8fc5f9..d5deb5b60 100644 --- a/net/cert/ct_objects_extractor.h +++ b/net/cert/ct_objects_extractor.h
@@ -7,6 +7,7 @@ #include <string> +#include "base/strings/string_piece.h" #include "net/base/net_export.h" #include "net/cert/x509_certificate.h" @@ -54,7 +55,7 @@ NET_EXPORT_PRIVATE bool ExtractSCTListFromOCSPResponse( X509Certificate::OSCertHandle issuer, const std::string& cert_serial_number, - const std::string& ocsp_response, + base::StringPiece ocsp_response, std::string* sct_list); } // namespace ct
diff --git a/net/cert/ct_objects_extractor_unittest.cc b/net/cert/ct_objects_extractor_unittest.cc index 7efec35..8f88969 100644 --- a/net/cert/ct_objects_extractor_unittest.cc +++ b/net/cert/ct_objects_extractor_unittest.cc
@@ -44,8 +44,7 @@ std::vector<base::StringPiece> parsed_scts; base::StringPiece sct_list_sp(sct_list); // Make sure the SCT list can be decoded properly - EXPECT_TRUE(DecodeSCTList(&sct_list_sp, &parsed_scts)); - + EXPECT_TRUE(DecodeSCTList(sct_list_sp, &parsed_scts)); EXPECT_TRUE(DecodeSignedCertificateTimestamp(&parsed_scts[0], sct)); }
diff --git a/net/cert/ct_serialization.cc b/net/cert/ct_serialization.cc index 60d9426..64a6ff5 100644 --- a/net/cert/ct_serialization.cc +++ b/net/cert/ct_serialization.cc
@@ -383,15 +383,15 @@ output); } -bool DecodeSCTList(base::StringPiece* input, +bool DecodeSCTList(base::StringPiece input, std::vector<base::StringPiece>* output) { std::vector<base::StringPiece> result; - if (!ReadList(kSCTListLengthBytes, kSerializedSCTLengthBytes, - input, &result)) { + if (!ReadList(kSCTListLengthBytes, kSerializedSCTLengthBytes, &input, + &result)) { return false; } - if (!input->empty() || result.empty()) + if (!input.empty() || result.empty()) return false; output->swap(result); return true;
diff --git a/net/cert/ct_serialization.h b/net/cert/ct_serialization.h index 269892d..b5b3d77d 100644 --- a/net/cert/ct_serialization.h +++ b/net/cert/ct_serialization.h
@@ -75,7 +75,7 @@ // Returns true if the list could be read and decoded successfully, false // otherwise (note that the validity of each individual SCT should be checked // separately). -NET_EXPORT_PRIVATE bool DecodeSCTList(base::StringPiece* input, +NET_EXPORT_PRIVATE bool DecodeSCTList(base::StringPiece input, std::vector<base::StringPiece>* output); // Decodes a single SCT from |input| to |output|.
diff --git a/net/cert/ct_serialization_unittest.cc b/net/cert/ct_serialization_unittest.cc index be84d8f..6ddb329 100644 --- a/net/cert/ct_serialization_unittest.cc +++ b/net/cert/ct_serialization_unittest.cc
@@ -141,7 +141,7 @@ base::StringPiece encoded("\x0\xa\x0\x3\x61\x62\x63\x0\x3\x64\x65\x66", 12); std::vector<base::StringPiece> decoded; - ASSERT_TRUE(ct::DecodeSCTList(&encoded, &decoded)); + ASSERT_TRUE(ct::DecodeSCTList(encoded, &decoded)); ASSERT_STREQ("abc", decoded[0].data()); ASSERT_STREQ("def", decoded[1].data()); } @@ -151,7 +151,7 @@ base::StringPiece encoded("\x0\xa\x0\x3\x61\x62\x63\x0\x5\x64\x65\x66", 12); std::vector<base::StringPiece> decoded; - ASSERT_FALSE(ct::DecodeSCTList(&encoded, &decoded)); + ASSERT_FALSE(ct::DecodeSCTList(encoded, &decoded)); } TEST_F(CtSerializationTest, DecodesSignedCertificateTimestamp) {
diff --git a/net/cert/ct_signed_certificate_timestamp_log_param.cc b/net/cert/ct_signed_certificate_timestamp_log_param.cc index 395c81e..d92f0288 100644 --- a/net/cert/ct_signed_certificate_timestamp_log_param.cc +++ b/net/cert/ct_signed_certificate_timestamp_log_param.cc
@@ -21,10 +21,9 @@ // Base64 encode the given |value| string and put it in |dict| with the // description |key|. -void SetBinaryData( - const char* key, - const std::string& value, - base::DictionaryValue* dict) { +void SetBinaryData(const char* key, + base::StringPiece value, + base::DictionaryValue* dict) { std::string b64_value; base::Base64Encode(value, &b64_value); @@ -84,15 +83,15 @@ } std::unique_ptr<base::Value> NetLogRawSignedCertificateTimestampCallback( - const std::string* embedded_scts, - const std::string* sct_list_from_ocsp, - const std::string* sct_list_from_tls_extension, + base::StringPiece embedded_scts, + base::StringPiece sct_list_from_ocsp, + base::StringPiece sct_list_from_tls_extension, NetLogCaptureMode capture_mode) { std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); - SetBinaryData("embedded_scts", *embedded_scts, dict.get()); - SetBinaryData("scts_from_ocsp_response", *sct_list_from_ocsp, dict.get()); - SetBinaryData("scts_from_tls_extension", *sct_list_from_tls_extension, + SetBinaryData("embedded_scts", embedded_scts, dict.get()); + SetBinaryData("scts_from_ocsp_response", sct_list_from_ocsp, dict.get()); + SetBinaryData("scts_from_tls_extension", sct_list_from_tls_extension, dict.get()); return std::move(dict);
diff --git a/net/cert/ct_signed_certificate_timestamp_log_param.h b/net/cert/ct_signed_certificate_timestamp_log_param.h index 373a752..c2149cdb 100644 --- a/net/cert/ct_signed_certificate_timestamp_log_param.h +++ b/net/cert/ct_signed_certificate_timestamp_log_param.h
@@ -6,8 +6,8 @@ #define NET_CERT_CT_SIGNED_CERTIFICATE_TIMESTAMP_LOG_PARAM_H_ #include <memory> -#include <string> +#include "base/strings/string_piece.h" #include "net/cert/signed_certificate_timestamp_and_status.h" namespace base { @@ -31,9 +31,9 @@ // See the documentation for SIGNED_CERTIFICATE_TIMESTAMPS_RECEIVED // in net/log/net_log_event_type_list.h std::unique_ptr<base::Value> NetLogRawSignedCertificateTimestampCallback( - const std::string* embedded_scts, - const std::string* sct_list_from_ocsp, - const std::string* sct_list_from_tls_extension, + base::StringPiece embedded_scts, + base::StringPiece sct_list_from_ocsp, + base::StringPiece sct_list_from_tls_extension, NetLogCaptureMode capture_mode); } // namespace net
diff --git a/net/cert/ct_verifier.h b/net/cert/ct_verifier.h index 2685410..b5b1c79 100644 --- a/net/cert/ct_verifier.h +++ b/net/cert/ct_verifier.h
@@ -5,8 +5,7 @@ #ifndef NET_CERT_CT_VERIFIER_H_ #define NET_CERT_CT_VERIFIER_H_ -#include <string> - +#include "base/strings/string_piece.h" #include "net/base/net_export.h" #include "net/cert/signed_certificate_timestamp_and_status.h" @@ -44,13 +43,13 @@ // (embedding, TLS extension or OCSP stapling). If no stapled OCSP response // is available, |stapled_ocsp_response| should be an empty string. If no SCT // TLS extension was negotiated, |sct_list_from_tls_extension| should be an - // empty string. |result| will be filled with the SCTs present, divided into - // categories based on the verification result. - virtual int Verify(X509Certificate* cert, - const std::string& stapled_ocsp_response, - const std::string& sct_list_from_tls_extension, - SignedCertificateTimestampAndStatusList* output_scts, - const NetLogWithSource& net_log) = 0; + // empty string. |output_scts| will be cleared and filled with the SCTs + // present, if any, along with their verification results. + virtual void Verify(X509Certificate* cert, + base::StringPiece stapled_ocsp_response, + base::StringPiece sct_list_from_tls_extension, + SignedCertificateTimestampAndStatusList* output_scts, + const NetLogWithSource& net_log) = 0; // Registers |observer| to receive notifications of validated SCTs. Does not // take ownership of the observer as the observer may be performing
diff --git a/net/cert/do_nothing_ct_verifier.cc b/net/cert/do_nothing_ct_verifier.cc index a22867a..0429d86 100644 --- a/net/cert/do_nothing_ct_verifier.cc +++ b/net/cert/do_nothing_ct_verifier.cc
@@ -11,14 +11,15 @@ DoNothingCTVerifier::DoNothingCTVerifier() = default; DoNothingCTVerifier::~DoNothingCTVerifier() = default; -int DoNothingCTVerifier::Verify( +void DoNothingCTVerifier::Verify( X509Certificate* cert, - const std::string& stapled_ocsp_response, - const std::string& sct_list_from_tls_extension, + base::StringPiece stapled_ocsp_response, + base::StringPiece sct_list_from_tls_extension, SignedCertificateTimestampAndStatusList* output_scts, const NetLogWithSource& net_log) { output_scts->clear(); - return ERR_CT_NO_SCTS_VERIFIED_OK; } +void DoNothingCTVerifier::SetObserver(Observer* observer) {} + } // namespace net
diff --git a/net/cert/do_nothing_ct_verifier.h b/net/cert/do_nothing_ct_verifier.h index c1220e2..025ffd1 100644 --- a/net/cert/do_nothing_ct_verifier.h +++ b/net/cert/do_nothing_ct_verifier.h
@@ -50,11 +50,13 @@ DoNothingCTVerifier(); ~DoNothingCTVerifier() override; - int Verify(X509Certificate* cert, - const std::string& stapled_ocsp_response, - const std::string& sct_list_from_tls_extension, - SignedCertificateTimestampAndStatusList* output_scts, - const NetLogWithSource& net_log) override; + void Verify(X509Certificate* cert, + base::StringPiece stapled_ocsp_response, + base::StringPiece sct_list_from_tls_extension, + SignedCertificateTimestampAndStatusList* output_scts, + const NetLogWithSource& net_log) override; + + void SetObserver(Observer* observer) override; private: DISALLOW_COPY_AND_ASSIGN(DoNothingCTVerifier);
diff --git a/net/cert/multi_log_ct_verifier.cc b/net/cert/multi_log_ct_verifier.cc index 61c07b6..a372b05c 100644 --- a/net/cert/multi_log_ct_verifier.cc +++ b/net/cert/multi_log_ct_verifier.cc
@@ -81,10 +81,10 @@ observer_ = observer; } -int MultiLogCTVerifier::Verify( +void MultiLogCTVerifier::Verify( X509Certificate* cert, - const std::string& stapled_ocsp_response, - const std::string& sct_list_from_tls_extension, + base::StringPiece stapled_ocsp_response, + base::StringPiece sct_list_from_tls_extension, SignedCertificateTimestampAndStatusList* output_scts, const NetLogWithSource& net_log) { DCHECK(cert); @@ -92,8 +92,6 @@ output_scts->clear(); - bool has_verified_scts = false; - std::string embedded_scts; if (!cert->GetIntermediateCertificates().empty() && ct::ExtractEmbeddedSCTList( @@ -101,13 +99,13 @@ &embedded_scts)) { ct::LogEntry precert_entry; - has_verified_scts = - ct::GetPrecertLogEntry(cert->os_cert_handle(), + if (ct::GetPrecertLogEntry(cert->os_cert_handle(), cert->GetIntermediateCertificates().front(), - &precert_entry) && - VerifySCTs(embedded_scts, precert_entry, - ct::SignedCertificateTimestamp::SCT_EMBEDDED, cert, - output_scts); + &precert_entry)) { + VerifySCTs(embedded_scts, precert_entry, + ct::SignedCertificateTimestamp::SCT_EMBEDDED, cert, + output_scts); + } } std::string sct_list_from_ocsp; @@ -121,23 +119,21 @@ // Log to Net Log, after extracting SCTs but before possibly failing on // X.509 entry creation. NetLogParametersCallback net_log_callback = - base::Bind(&NetLogRawSignedCertificateTimestampCallback, &embedded_scts, - &sct_list_from_ocsp, &sct_list_from_tls_extension); + base::Bind(&NetLogRawSignedCertificateTimestampCallback, embedded_scts, + sct_list_from_ocsp, sct_list_from_tls_extension); net_log.AddEvent(NetLogEventType::SIGNED_CERTIFICATE_TIMESTAMPS_RECEIVED, net_log_callback); ct::LogEntry x509_entry; if (ct::GetX509LogEntry(cert->os_cert_handle(), &x509_entry)) { - has_verified_scts |= - VerifySCTs(sct_list_from_ocsp, x509_entry, - ct::SignedCertificateTimestamp::SCT_FROM_OCSP_RESPONSE, cert, - output_scts); + VerifySCTs(sct_list_from_ocsp, x509_entry, + ct::SignedCertificateTimestamp::SCT_FROM_OCSP_RESPONSE, cert, + output_scts); - has_verified_scts |= - VerifySCTs(sct_list_from_tls_extension, x509_entry, - ct::SignedCertificateTimestamp::SCT_FROM_TLS_EXTENSION, cert, - output_scts); + VerifySCTs(sct_list_from_tls_extension, x509_entry, + ct::SignedCertificateTimestamp::SCT_FROM_TLS_EXTENSION, cert, + output_scts); } NetLogParametersCallback net_log_checked_callback = @@ -147,29 +143,22 @@ net_log_checked_callback); LogNumSCTsToUMA(*output_scts); - - if (has_verified_scts) - return OK; - - return ERR_CT_NO_SCTS_VERIFIED_OK; } -bool MultiLogCTVerifier::VerifySCTs( - const std::string& encoded_sct_list, +void MultiLogCTVerifier::VerifySCTs( + base::StringPiece encoded_sct_list, const ct::LogEntry& expected_entry, ct::SignedCertificateTimestamp::Origin origin, X509Certificate* cert, SignedCertificateTimestampAndStatusList* output_scts) { if (logs_.empty()) - return false; + return; - base::StringPiece temp(encoded_sct_list); std::vector<base::StringPiece> sct_list; - if (!ct::DecodeSCTList(&temp, &sct_list)) - return false; + if (!ct::DecodeSCTList(encoded_sct_list, &sct_list)) + return; - bool verified = false; for (std::vector<base::StringPiece>::const_iterator it = sct_list.begin(); it != sct_list.end(); ++it) { base::StringPiece encoded_sct(*it); @@ -178,15 +167,12 @@ scoped_refptr<ct::SignedCertificateTimestamp> decoded_sct; if (!DecodeSignedCertificateTimestamp(&encoded_sct, &decoded_sct)) { LogSCTStatusToUMA(ct::SCT_STATUS_NONE); - // XXX(rsleevi): Should we really just skip over bad SCTs? continue; } decoded_sct->origin = origin; - verified |= VerifySingleSCT(decoded_sct, expected_entry, cert, output_scts); + VerifySingleSCT(decoded_sct, expected_entry, cert, output_scts); } - - return verified; } bool MultiLogCTVerifier::VerifySingleSCT(
diff --git a/net/cert/multi_log_ct_verifier.h b/net/cert/multi_log_ct_verifier.h index 05c2c06..d4cb56f 100644 --- a/net/cert/multi_log_ct_verifier.h +++ b/net/cert/multi_log_ct_verifier.h
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/strings/string_piece.h" #include "net/base/net_export.h" #include "net/cert/ct_verifier.h" #include "net/cert/signed_certificate_timestamp.h" @@ -34,19 +35,19 @@ const std::vector<scoped_refptr<const CTLogVerifier>>& log_verifiers); // CTVerifier implementation: - int Verify(X509Certificate* cert, - const std::string& stapled_ocsp_response, - const std::string& sct_list_from_tls_extension, - SignedCertificateTimestampAndStatusList* output_scts, - const NetLogWithSource& net_log) override; + void Verify(X509Certificate* cert, + base::StringPiece stapled_ocsp_response, + base::StringPiece sct_list_from_tls_extension, + SignedCertificateTimestampAndStatusList* output_scts, + const NetLogWithSource& net_log) override; void SetObserver(Observer* observer) override; private: // Verify a list of SCTs from |encoded_sct_list| over |expected_entry|, - // placing the verification results in |result|. The SCTs in the list + // placing the verification results in |output_scts|. The SCTs in the list // come from |origin| (as will be indicated in the origin field of each SCT). - bool VerifySCTs(const std::string& encoded_sct_list, + void VerifySCTs(base::StringPiece encoded_sct_list, const ct::LogEntry& expected_entry, ct::SignedCertificateTimestamp::Origin origin, X509Certificate* cert,
diff --git a/net/cert/multi_log_ct_verifier_unittest.cc b/net/cert/multi_log_ct_verifier_unittest.cc index 3111b5e45..aea27f9 100644 --- a/net/cert/multi_log_ct_verifier_unittest.cc +++ b/net/cert/multi_log_ct_verifier_unittest.cc
@@ -111,30 +111,29 @@ return true; } - bool VerifySinglePrecertificateChain( - scoped_refptr<X509Certificate> chain, - const NetLogWithSource& net_log, - SignedCertificateTimestampAndStatusList* output_scts) { - return verifier_->Verify(chain.get(), std::string(), std::string(), - output_scts, net_log) == OK; - } - + // Returns true is |chain| is a certificate with embedded SCTs that can be + // successfully extracted. bool VerifySinglePrecertificateChain(scoped_refptr<X509Certificate> chain) { SignedCertificateTimestampAndStatusList scts; - return verifier_->Verify(chain.get(), std::string(), std::string(), &scts, - NetLogWithSource()) == OK; + verifier_->Verify(chain.get(), base::StringPiece(), base::StringPiece(), + &scts, NetLogWithSource()); + return !scts.empty(); } + // Returns true if |chain| is a certificate with a single embedded SCT that + // can be successfully extracted and matched to the test log indicated by + // |kLogDescription|. bool CheckPrecertificateVerification(scoped_refptr<X509Certificate> chain) { SignedCertificateTimestampAndStatusList scts; TestNetLog test_net_log; NetLogWithSource net_log = NetLogWithSource::Make( &test_net_log, NetLogSourceType::SSL_CONNECT_JOB); - return (VerifySinglePrecertificateChain(chain, net_log, &scts) && - ct::CheckForSingleVerifiedSCTInResult(scts, kLogDescription) && - ct::CheckForSCTOrigin( - scts, ct::SignedCertificateTimestamp::SCT_EMBEDDED) && - CheckForEmbeddedSCTInNetLog(test_net_log)); + verifier_->Verify(chain.get(), base::StringPiece(), base::StringPiece(), + &scts, net_log); + return ct::CheckForSingleVerifiedSCTInResult(scts, kLogDescription) && + ct::CheckForSCTOrigin( + scts, ct::SignedCertificateTimestamp::SCT_EMBEDDED) && + CheckForEmbeddedSCTInNetLog(test_net_log); } // Histogram-related helper methods @@ -208,8 +207,8 @@ std::string sct_list = ct::GetSCTListForTesting(); SignedCertificateTimestampAndStatusList scts; - EXPECT_EQ(OK, verifier_->Verify(chain_.get(), std::string(), sct_list, &scts, - NetLogWithSource())); + verifier_->Verify(chain_.get(), base::StringPiece(), sct_list, &scts, + NetLogWithSource()); ASSERT_TRUE(ct::CheckForSingleVerifiedSCTInResult(scts, kLogDescription)); ASSERT_TRUE(ct::CheckForSCTOrigin( scts, ct::SignedCertificateTimestamp::SCT_FROM_TLS_EXTENSION)); @@ -219,8 +218,8 @@ std::string sct_list = ct::GetSCTListWithInvalidSCT(); SignedCertificateTimestampAndStatusList scts; - EXPECT_NE(OK, verifier_->Verify(chain_.get(), std::string(), sct_list, &scts, - NetLogWithSource())); + verifier_->Verify(chain_.get(), base::StringPiece(), sct_list, &scts, + NetLogWithSource()); EXPECT_EQ(1U, scts.size()); EXPECT_EQ("", scts[0].sct->log_description); EXPECT_EQ(ct::SCT_STATUS_LOG_UNKNOWN, scts[0].status); @@ -242,8 +241,8 @@ int num_invalid_scts = GetValueFromHistogram( "Net.CertificateTransparency.SCTStatus", ct::SCT_STATUS_LOG_UNKNOWN); - EXPECT_NE(OK, verifier_->Verify(chain_.get(), std::string(), sct_list, &scts, - NetLogWithSource())); + verifier_->Verify(chain_.get(), base::StringPiece(), sct_list, &scts, + NetLogWithSource()); ASSERT_EQ(num_valid_scts, NumValidSCTsInStatusHistogram()); ASSERT_EQ(num_invalid_scts + 1,
diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc index ce16cca..5f82c28 100644 --- a/net/http/transport_security_state.cc +++ b/net/http/transport_security_state.cc
@@ -687,7 +687,7 @@ bool SerializeExpectStapleReport(const HostPortPair& host_port_pair, const SSLInfo& ssl_info, - const std::string& ocsp_response, + base::StringPiece ocsp_response, std::string* out_serialized_report) { DCHECK(ssl_info.is_issued_by_known_root); base::DictionaryValue report; @@ -794,7 +794,7 @@ void TransportSecurityState::CheckExpectStaple( const HostPortPair& host_port_pair, const SSLInfo& ssl_info, - const std::string& ocsp_response) { + base::StringPiece ocsp_response) { DCHECK(CalledOnValidThread()); if (!enable_static_expect_staple_ || !report_sender_ || !ssl_info.is_issued_by_known_root) {
diff --git a/net/http/transport_security_state.h b/net/http/transport_security_state.h index fc40b7d..c020ec1 100644 --- a/net/http/transport_security_state.h +++ b/net/http/transport_security_state.h
@@ -322,7 +322,7 @@ // for OCSP responses behind MITM proxies are not useful to site owners. void CheckExpectStaple(const HostPortPair& host_port_pair, const SSLInfo& ssl_info, - const std::string& ocsp_response); + base::StringPiece ocsp_response); // Returns true if connections to |host|, using the validated certificate // |validated_certificate_chain|, are expected to be accompanied with
diff --git a/net/socket/ssl_client_socket_impl.cc b/net/socket/ssl_client_socket_impl.cc index 3202d437..97c6752 100644 --- a/net/socket/ssl_client_socket_impl.cc +++ b/net/socket/ssl_client_socket_impl.cc
@@ -1172,11 +1172,6 @@ const uint8_t* ocsp_response_raw; size_t ocsp_response_len; SSL_get0_ocsp_response(ssl_.get(), &ocsp_response_raw, &ocsp_response_len); - std::string ocsp_response; - if (ocsp_response_len > 0) { - ocsp_response_.assign(reinterpret_cast<const char*>(ocsp_response_raw), - ocsp_response_len); - } set_stapled_ocsp_response_received(ocsp_response_len != 0); UMA_HISTOGRAM_BOOLEAN("Net.OCSPResponseStapled", ocsp_response_len != 0); @@ -1258,10 +1253,16 @@ start_cert_verification_time_ = base::TimeTicks::Now(); + const uint8_t* ocsp_response_raw; + size_t ocsp_response_len; + SSL_get0_ocsp_response(ssl_.get(), &ocsp_response_raw, &ocsp_response_len); + base::StringPiece ocsp_response( + reinterpret_cast<const char*>(ocsp_response_raw), ocsp_response_len); + return cert_verifier_->Verify( CertVerifier::RequestParams(server_cert_, host_and_port_.host(), ssl_config_.GetCertVerifyFlags(), - ocsp_response_, CertificateList()), + ocsp_response.as_string(), CertificateList()), // TODO(davidben): Route the CRLSet through SSLConfig so // SSLClientSocket doesn't depend on SSLConfigService. SSLConfigService::GetCRLSet().get(), &server_cert_verify_result_, @@ -1319,8 +1320,15 @@ SSLInfo ssl_info; bool ok = GetSSLInfo(&ssl_info); DCHECK(ok); + + const uint8_t* ocsp_response_raw; + size_t ocsp_response_len; + SSL_get0_ocsp_response(ssl_.get(), &ocsp_response_raw, &ocsp_response_len); + base::StringPiece ocsp_response( + reinterpret_cast<const char*>(ocsp_response_raw), ocsp_response_len); + transport_security_state_->CheckExpectStaple(host_and_port_, ssl_info, - ocsp_response_); + ocsp_response); } completed_connect_ = true; @@ -1557,15 +1565,20 @@ const uint8_t* sct_list_raw; size_t sct_list_len; SSL_get0_signed_cert_timestamp_list(ssl_.get(), &sct_list_raw, &sct_list_len); - std::string sct_list; - if (sct_list_len > 0) - sct_list.assign(reinterpret_cast<const char*>(sct_list_raw), sct_list_len); + base::StringPiece sct_list(reinterpret_cast<const char*>(sct_list_raw), + sct_list_len); + + const uint8_t* ocsp_response_raw; + size_t ocsp_response_len; + SSL_get0_ocsp_response(ssl_.get(), &ocsp_response_raw, &ocsp_response_len); + base::StringPiece ocsp_response( + reinterpret_cast<const char*>(ocsp_response_raw), ocsp_response_len); // Note that this is a completely synchronous operation: The CT Log Verifier // gets all the data it needs for SCT verification and does not do any // external communication. cert_transparency_verifier_->Verify( - server_cert_verify_result_.verified_cert.get(), ocsp_response_, sct_list, + server_cert_verify_result_.verified_cert.get(), ocsp_response, sct_list, &ct_verify_result_.scts, net_log_); ct_verify_result_.ct_policies_applied = true;
diff --git a/net/socket/ssl_client_socket_impl.h b/net/socket/ssl_client_socket_impl.h index b997beb..4d44008 100644 --- a/net/socket/ssl_client_socket_impl.h +++ b/net/socket/ssl_client_socket_impl.h
@@ -277,7 +277,6 @@ std::unique_ptr<PeerCertificateChain> server_cert_chain_; scoped_refptr<X509Certificate> server_cert_; CertVerifyResult server_cert_verify_result_; - std::string ocsp_response_; bool completed_connect_; // Set when Read() or Write() successfully reads or writes data to or from the
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 74d8c83b..75f3f4f 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc
@@ -30,6 +30,7 @@ #include "net/cert/ct_policy_enforcer.h" #include "net/cert/ct_policy_status.h" #include "net/cert/ct_verifier.h" +#include "net/cert/do_nothing_ct_verifier.h" #include "net/cert/mock_cert_verifier.h" #include "net/cert/signed_certificate_timestamp_and_status.h" #include "net/cert/test_root_certs.h" @@ -706,11 +707,11 @@ class MockCTVerifier : public CTVerifier { public: MOCK_METHOD5(Verify, - int(X509Certificate*, - const std::string&, - const std::string&, - SignedCertificateTimestampAndStatusList*, - const NetLogWithSource&)); + void(X509Certificate*, + base::StringPiece, + base::StringPiece, + SignedCertificateTimestampAndStatusList*, + const NetLogWithSource&)); MOCK_METHOD1(SetObserver, void(CTVerifier::Observer*)); }; @@ -740,7 +741,7 @@ : socket_factory_(ClientSocketFactory::GetDefaultFactory()), cert_verifier_(new MockCertVerifier), transport_security_state_(new TransportSecurityState), - ct_verifier_(new MockCTVerifier), + ct_verifier_(new DoNothingCTVerifier), ct_policy_enforcer_(new MockCTPolicyEnforcer) { cert_verifier_->set_default_result(OK); context_.cert_verifier = cert_verifier_.get(); @@ -748,8 +749,6 @@ context_.cert_transparency_verifier = ct_verifier_.get(); context_.ct_policy_enforcer = ct_policy_enforcer_.get(); - EXPECT_CALL(*ct_verifier_, Verify(_, _, _, _, _)) - .WillRepeatedly(Return(OK)); EXPECT_CALL(*ct_policy_enforcer_, DoesConformToCertPolicy(_, _, _)) .WillRepeatedly( Return(ct::CertPolicyCompliance::CERT_POLICY_COMPLIES_VIA_SCTS)); @@ -847,7 +846,7 @@ ClientSocketFactory* socket_factory_; std::unique_ptr<MockCertVerifier> cert_verifier_; std::unique_ptr<TransportSecurityState> transport_security_state_; - std::unique_ptr<MockCTVerifier> ct_verifier_; + std::unique_ptr<DoNothingCTVerifier> ct_verifier_; std::unique_ptr<MockCTPolicyEnforcer> ct_policy_enforcer_; SSLClientSocketContext context_; std::unique_ptr<SSLClientSocket> sock_; @@ -2303,10 +2302,10 @@ TEST_F(SSLClientSocketTest, ConnectSignedCertTimestampsEnabledTLSExtension) { // Encoding of SCT List containing 'test'. - std::string sct_ext("\x00\x06\x00\x04test", 8); + base::StringPiece sct_ext("\x00\x06\x00\x04test", 8); SpawnedTestServer::SSLOptions ssl_options; - ssl_options.signed_cert_timestamps_tls_ext = sct_ext; + ssl_options.signed_cert_timestamps_tls_ext = sct_ext.as_string(); ASSERT_TRUE(StartTestServer(ssl_options)); SSLConfig ssl_config; @@ -2315,9 +2314,11 @@ MockCTVerifier ct_verifier; SetCTVerifier(&ct_verifier); - // Check that the SCT list is extracted as expected. - EXPECT_CALL(ct_verifier, Verify(_, "", sct_ext, _, _)) - .WillRepeatedly(Return(ERR_CT_NO_SCTS_VERIFIED_OK)); + // Check that the SCT list is extracted from the TLS extension as expected, + // while also simulating that it was an unparsable response. + SignedCertificateTimestampAndStatusList sct_list; + EXPECT_CALL(ct_verifier, Verify(_, _, sct_ext, _, _)) + .WillOnce(testing::SetArgPointee<3>(sct_list)); int rv; ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); @@ -2326,27 +2327,6 @@ EXPECT_TRUE(sock_->signed_cert_timestamps_received_); } -// Test that when an EV certificate is received, but no CT verifier -// or certificate policy enforcer are defined, then the EV status -// of the certificate is maintained. -TEST_F(SSLClientSocketTest, EVCertStatusMaintainedNoCTVerifier) { - SpawnedTestServer::SSLOptions ssl_options; - ASSERT_TRUE(StartTestServer(ssl_options)); - - SSLConfig ssl_config; - AddServerCertStatusToSSLConfig(CERT_STATUS_IS_EV, &ssl_config); - - // No verifier to skip CT and policy checks. - int rv; - ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); - EXPECT_THAT(rv, IsOk()); - - SSLInfo result; - ASSERT_TRUE(sock_->GetSSLInfo(&result)); - - EXPECT_TRUE(result.cert_status & CERT_STATUS_IS_EV); -} - // Test that when a CT verifier and a CTPolicyEnforcer are defined, and // the EV certificate used conforms to the CT/EV policy, its EV status // is maintained. @@ -2357,12 +2337,6 @@ SSLConfig ssl_config; AddServerCertStatusToSSLConfig(CERT_STATUS_IS_EV, &ssl_config); - // To activate the CT/EV policy enforcement non-null CTVerifier and - // CTPolicyEnforcer are needed. - MockCTVerifier ct_verifier; - SetCTVerifier(&ct_verifier); - EXPECT_CALL(ct_verifier, Verify(_, "", "", _, _)).WillRepeatedly(Return(OK)); - // Emulate compliance of the certificate to the policy. MockCTPolicyEnforcer policy_enforcer; SetCTPolicyEnforcer(&policy_enforcer); @@ -2393,12 +2367,6 @@ SSLConfig ssl_config; AddServerCertStatusToSSLConfig(CERT_STATUS_IS_EV, &ssl_config); - // To activate the CT/EV policy enforcement non-null CTVerifier and - // CTPolicyEnforcer are needed. - MockCTVerifier ct_verifier; - SetCTVerifier(&ct_verifier); - EXPECT_CALL(ct_verifier, Verify(_, "", "", _, _)).WillRepeatedly(Return(OK)); - // Emulate non-compliance of the certificate to the policy. MockCTPolicyEnforcer policy_enforcer; SetCTPolicyEnforcer(&policy_enforcer); @@ -2420,20 +2388,6 @@ EXPECT_TRUE(result.cert_status & CERT_STATUS_CT_COMPLIANCE_FAILED); } -namespace { - -bool IsValidOCSPResponse(const base::StringPiece& input) { - der::Parser parser((der::Input(input))); - der::Parser sequence; - return parser.ReadSequence(&sequence) && !parser.HasMore() && - sequence.SkipTag(der::kEnumerated) && - sequence.SkipTag(der::kTagContextSpecific | der::kTagConstructed | - 0) && - !sequence.HasMore(); -} - -} // namespace - // Test that enabling Signed Certificate Timestamps enables OCSP stapling. TEST_F(SSLClientSocketTest, ConnectSignedCertTimestampsEnabledOCSP) { SpawnedTestServer::SSLOptions ssl_options; @@ -2450,18 +2404,6 @@ // is able to process the OCSP status itself. ssl_config.signed_cert_timestamps_enabled = true; - MockCTVerifier ct_verifier; - SetCTVerifier(&ct_verifier); - - // Check that the OCSP response is extracted and well-formed. It should be the - // DER encoding of an OCSPResponse (RFC 2560), so check that it consists of a - // SEQUENCE of an ENUMERATED type and an element tagged with [0] EXPLICIT. In - // particular, it should not include the overall two-byte length prefix from - // TLS. - EXPECT_CALL(ct_verifier, - Verify(_, Truly(IsValidOCSPResponse), "", _, _)).WillRepeatedly( - Return(ERR_CT_NO_SCTS_VERIFIED_OK)); - int rv; ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); EXPECT_THAT(rv, IsOk());
diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc index ced19d2..d99008c 100644 --- a/net/socket/ssl_server_socket_unittest.cc +++ b/net/socket/ssl_server_socket_unittest.cc
@@ -45,7 +45,7 @@ #include "net/cert/cert_status_flags.h" #include "net/cert/ct_policy_enforcer.h" #include "net/cert/ct_policy_status.h" -#include "net/cert/ct_verifier.h" +#include "net/cert/do_nothing_ct_verifier.h" #include "net/cert/mock_cert_verifier.h" #include "net/cert/mock_client_cert_verifier.h" #include "net/cert/signed_certificate_timestamp_and_status.h" @@ -86,22 +86,6 @@ const char kWrongClientPrivateKeyFileName[] = "client_2.pk8"; const char kClientCertCAFileName[] = "client_1_ca.pem"; -class MockCTVerifier : public CTVerifier { - public: - MockCTVerifier() = default; - ~MockCTVerifier() override = default; - - int Verify(X509Certificate* cert, - const std::string& stapled_ocsp_response, - const std::string& sct_list_from_tls_extension, - SignedCertificateTimestampAndStatusList* output_scts, - const NetLogWithSource& net_log) override { - return net::OK; - } - - void SetObserver(Observer* observer) override {} -}; - class MockCTPolicyEnforcer : public CTPolicyEnforcer { public: MockCTPolicyEnforcer() = default; @@ -374,7 +358,7 @@ cert_verifier_(new MockCertVerifier()), client_cert_verifier_(new MockClientCertVerifier()), transport_security_state_(new TransportSecurityState), - ct_verifier_(new MockCTVerifier), + ct_verifier_(new DoNothingCTVerifier), ct_policy_enforcer_(new MockCTPolicyEnforcer) {} void SetUp() override { @@ -509,7 +493,7 @@ std::unique_ptr<MockCertVerifier> cert_verifier_; std::unique_ptr<MockClientCertVerifier> client_cert_verifier_; std::unique_ptr<TransportSecurityState> transport_security_state_; - std::unique_ptr<MockCTVerifier> ct_verifier_; + std::unique_ptr<DoNothingCTVerifier> ct_verifier_; std::unique_ptr<MockCTPolicyEnforcer> ct_policy_enforcer_; std::unique_ptr<SSLServerContext> server_context_; std::unique_ptr<crypto::RSAPrivateKey> server_private_key_;
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc index 305d99cf..754f447e 100644 --- a/net/spdy/spdy_test_util_common.cc +++ b/net/spdy/spdy_test_util_common.cc
@@ -17,8 +17,8 @@ #include "net/base/host_port_pair.h" #include "net/cert/ct_policy_enforcer.h" #include "net/cert/ct_policy_status.h" +#include "net/cert/do_nothing_ct_verifier.h" #include "net/cert/mock_cert_verifier.h" -#include "net/cert/multi_log_ct_verifier.h" #include "net/cert/signed_certificate_timestamp_and_status.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" @@ -330,7 +330,7 @@ cert_verifier(new MockCertVerifier), channel_id_service(nullptr), transport_security_state(new TransportSecurityState), - cert_transparency_verifier(new MultiLogCTVerifier), + cert_transparency_verifier(new DoNothingCTVerifier), ct_policy_enforcer(new CTPolicyEnforcer), proxy_service(std::move(proxy_service)), ssl_config_service(new SSLConfigServiceDefaults), @@ -427,22 +427,6 @@ } }; -class IgnoresCTVerifier : public net::CTVerifier { - public: - IgnoresCTVerifier() = default; - ~IgnoresCTVerifier() override = default; - - int Verify(net::X509Certificate* cert, - const std::string& stapled_ocsp_response, - const std::string& sct_list_from_tls_extension, - SignedCertificateTimestampAndStatusList* output_scts, - const net::NetLogWithSource& net_log) override { - return net::OK; - } - - void SetObserver(Observer* observer) override {} -}; - SpdyURLRequestContext::SpdyURLRequestContext() : storage_(this) { storage_.set_host_resolver( std::unique_ptr<HostResolver>(new MockHostResolver)); @@ -453,7 +437,7 @@ storage_.set_ct_policy_enforcer( base::WrapUnique(new AllowAnyCertCTPolicyEnforcer())); storage_.set_cert_transparency_verifier( - base::WrapUnique(new IgnoresCTVerifier())); + base::WrapUnique(new DoNothingCTVerifier())); storage_.set_ssl_config_service(new SSLConfigServiceDefaults); storage_.set_http_auth_handler_factory( HttpAuthHandlerFactory::CreateDefault(host_resolver()));
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 1028f1c..616eb319 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc
@@ -60,7 +60,7 @@ #include "net/base/url_util.h" #include "net/cert/ct_policy_enforcer.h" #include "net/cert/ct_policy_status.h" -#include "net/cert/ct_verifier.h" +#include "net/cert/do_nothing_ct_verifier.h" #include "net/cert/ev_root_ca_metadata.h" #include "net/cert/mock_cert_verifier.h" #include "net/cert/signed_certificate_timestamp_and_status.h" @@ -6444,23 +6444,6 @@ uint32_t num_failures_; }; -// A CTVerifier that returns net::OK for every certificate. -class MockCTVerifier : public CTVerifier { - public: - MockCTVerifier() {} - ~MockCTVerifier() override {} - - int Verify(X509Certificate* cert, - const std::string& stapled_ocsp_response, - const std::string& sct_list_from_tls_extension, - SignedCertificateTimestampAndStatusList* output_scts, - const NetLogWithSource& net_log) override { - return net::OK; - } - - void SetObserver(Observer* observer) override {} -}; - // A CTPolicyEnforcer that returns a default CertPolicyCompliance value // for every certificate. class MockCTPolicyEnforcer : public CTPolicyEnforcer { @@ -6508,9 +6491,9 @@ verify_result.is_issued_by_known_root = true; cert_verifier.AddResultForCert(cert.get(), verify_result, OK); - // Set up a MockCTVerifier and MockCTPolicyEnforcer to trigger an Expect CT - // violation. - MockCTVerifier ct_verifier; + // Set up a DoNothingCTVerifier and MockCTPolicyEnforcer to trigger an Expect + // CT violation. + DoNothingCTVerifier ct_verifier; MockCTPolicyEnforcer ct_policy_enforcer; ct_policy_enforcer.set_default_result( ct::CertPolicyCompliance::CERT_POLICY_NOT_ENOUGH_SCTS);
diff --git a/remoting/protocol/ssl_hmac_channel_authenticator.cc b/remoting/protocol/ssl_hmac_channel_authenticator.cc index ce9b5a5..177699a 100644 --- a/remoting/protocol/ssl_hmac_channel_authenticator.cc +++ b/remoting/protocol/ssl_hmac_channel_authenticator.cc
@@ -24,7 +24,7 @@ #include "net/cert/cert_verify_result.h" #include "net/cert/ct_policy_enforcer.h" #include "net/cert/ct_policy_status.h" -#include "net/cert/ct_verifier.h" +#include "net/cert/do_nothing_ct_verifier.h" #include "net/cert/signed_certificate_timestamp_and_status.h" #include "net/cert/x509_certificate.h" #include "net/http/transport_security_state.h" @@ -67,23 +67,6 @@ } }; -// A CTVerifier which ignores Certificate Transparency information. -class IgnoresCTVerifier : public net::CTVerifier { - public: - IgnoresCTVerifier() = default; - ~IgnoresCTVerifier() override = default; - - int Verify(net::X509Certificate* cert, - const std::string& stapled_ocsp_response, - const std::string& sct_list_from_tls_extension, - net::SignedCertificateTimestampAndStatusList* output_scts, - const net::NetLogWithSource& net_log) override { - return net::OK; - } - - void SetObserver(Observer* observer) override {} -}; - // A CTPolicyEnforcer that accepts all certificates. class IgnoresCTPolicyEnforcer : public net::CTPolicyEnforcer { public: @@ -284,7 +267,7 @@ } else { transport_security_state_.reset(new net::TransportSecurityState); cert_verifier_.reset(new FailingCertVerifier); - ct_verifier_.reset(new IgnoresCTVerifier); + ct_verifier_.reset(new net::DoNothingCTVerifier); ct_policy_enforcer_.reset(new IgnoresCTPolicyEnforcer); net::SSLConfig ssl_config;
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index cb53ea11..4f7d585f 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -730,7 +730,6 @@ crbug.com/432129 fast/html/marquee-scroll.html [ Failure Pass ] crbug.com/248938 [ Win Debug ] virtual/threaded/animations/transition-and-animation-2.html [ Timeout ] -crbug.com/248938 virtual/threaded/transitions/cancel-and-start-new.html [ Pass Failure ] crbug.com/248938 virtual/threaded/animations/change-keyframes-name.html [ Failure Pass Timeout ] crbug.com/248938 virtual/threaded/animations/change-one-anim.html [ Failure Pass ] crbug.com/326139 crbug.com/390125 media/video-frame-accurate-seek.html [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/fast/clip/clip-path-inline-element-crash-expected.html b/third_party/WebKit/LayoutTests/fast/clip/clip-path-inline-element-crash-expected.html new file mode 100644 index 0000000..e3ed000 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/clip/clip-path-inline-element-crash-expected.html
@@ -0,0 +1,2 @@ +<!doctype html> +<!-- Test passes if it does not crash. -->
diff --git a/third_party/WebKit/LayoutTests/fast/clip/clip-path-inline-element-crash.html b/third_party/WebKit/LayoutTests/fast/clip/clip-path-inline-element-crash.html new file mode 100644 index 0000000..1b090b71 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/clip/clip-path-inline-element-crash.html
@@ -0,0 +1,4 @@ +<!doctype html> +<!-- Test passes if it does not crash. --> +<custom-element style="clip-path: inset(10px 10px)"> + <span style="clip-path: inset(10px 10px); will-change: transform;">
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js index 8ead455..107c0da 100644 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js +++ b/third_party/WebKit/LayoutTests/http/tests/fetch/script-tests/request.js
@@ -505,7 +505,7 @@ // Spec: https://fetch.spec.whatwg.org/#dom-request // Step 21: // If request's method is `GET` or `HEAD`, throw a TypeError. -promise_test(function() { +test(function() { var headers = new Headers; headers.set('Content-Language', 'ja'); ['GET', 'HEAD'].forEach(function(method) {
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/serviceworker/request-base-https-other-https-expected.txt b/third_party/WebKit/LayoutTests/http/tests/fetch/serviceworker/request-base-https-other-https-expected.txt deleted file mode 100644 index 973e966..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/serviceworker/request-base-https-other-https-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -PASS Startup -PASS request -PASS Request basic test -PASS Request default value test -PASS Request header test -PASS Request header test -PASS Request credentials test -PASS Request redirect test -PASS Request integrity test -PASS Request method name throw test -PASS Request mode throw test -PASS Request: valid method names and normalize test -PASS Request construction with URLs with credentials. -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction failure should not set "bodyUsed" -PASS Request without RequestInit. -PASS Request with referrer=about:client. -PASS Request with no-referrer. -PASS Request with a url referrer -PASS Request with a url referrer containing user, pass, and so on -PASS Request with a url with another origin -PASS Request with an invalid referrer -PASS Request with a relative referrer -PASS Referrer policy settings -PASS Referrer policy should be cleared when any members are set -FAIL Request of GET/HEAD method cannot have RequestInit body. assert_not_equals: got disallowed value undefined -PASS Used => clone -PASS Test clone behavior with loading content from Request. -PASS Request body test -PASS Request throw error test -PASS MIME type for Blob -PASS MIME type for Blob with non-empty type -PASS MIME type for FormData -PASS MIME type for USVString -PASS Extract a MIME type with clone -PASS MIME type unchanged if headers are modified after Request() constructor -PASS Extract a MIME type (1) -PASS Credentials and body can both be set. -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/serviceworker/request-expected.txt b/third_party/WebKit/LayoutTests/http/tests/fetch/serviceworker/request-expected.txt deleted file mode 100644 index 973e966..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/serviceworker/request-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -PASS Startup -PASS request -PASS Request basic test -PASS Request default value test -PASS Request header test -PASS Request header test -PASS Request credentials test -PASS Request redirect test -PASS Request integrity test -PASS Request method name throw test -PASS Request mode throw test -PASS Request: valid method names and normalize test -PASS Request construction with URLs with credentials. -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction failure should not set "bodyUsed" -PASS Request without RequestInit. -PASS Request with referrer=about:client. -PASS Request with no-referrer. -PASS Request with a url referrer -PASS Request with a url referrer containing user, pass, and so on -PASS Request with a url with another origin -PASS Request with an invalid referrer -PASS Request with a relative referrer -PASS Referrer policy settings -PASS Referrer policy should be cleared when any members are set -FAIL Request of GET/HEAD method cannot have RequestInit body. assert_not_equals: got disallowed value undefined -PASS Used => clone -PASS Test clone behavior with loading content from Request. -PASS Request body test -PASS Request throw error test -PASS MIME type for Blob -PASS MIME type for Blob with non-empty type -PASS MIME type for FormData -PASS MIME type for USVString -PASS Extract a MIME type with clone -PASS MIME type unchanged if headers are modified after Request() constructor -PASS Extract a MIME type (1) -PASS Credentials and body can both be set. -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/window/request-base-https-other-https-expected.txt b/third_party/WebKit/LayoutTests/http/tests/fetch/window/request-base-https-other-https-expected.txt deleted file mode 100644 index 5da3360d..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/window/request-base-https-other-https-expected.txt +++ /dev/null
@@ -1,41 +0,0 @@ -This is a testharness.js-based test. -PASS Startup -PASS Request basic test -PASS Request default value test -PASS Request header test -PASS Request header test -PASS Request credentials test -PASS Request redirect test -PASS Request integrity test -PASS Request method name throw test -PASS Request mode throw test -PASS Request: valid method names and normalize test -PASS Request construction with URLs with credentials. -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction failure should not set "bodyUsed" -PASS Request without RequestInit. -PASS Request with referrer=about:client. -PASS Request with no-referrer. -PASS Request with a url referrer -PASS Request with a url referrer containing user, pass, and so on -PASS Request with a url with another origin -PASS Request with an invalid referrer -PASS Request with a relative referrer -PASS Referrer policy settings -PASS Referrer policy should be cleared when any members are set -FAIL Request of GET/HEAD method cannot have RequestInit body. assert_not_equals: got disallowed value undefined -PASS Used => clone -PASS Test clone behavior with loading content from Request. -PASS Request body test -PASS Request throw error test -PASS MIME type for Blob -PASS MIME type for Blob with non-empty type -PASS MIME type for FormData -PASS MIME type for USVString -PASS Extract a MIME type with clone -PASS MIME type unchanged if headers are modified after Request() constructor -PASS Extract a MIME type (1) -PASS Credentials and body can both be set. -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/window/request-expected.txt b/third_party/WebKit/LayoutTests/http/tests/fetch/window/request-expected.txt deleted file mode 100644 index 5da3360d..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/window/request-expected.txt +++ /dev/null
@@ -1,41 +0,0 @@ -This is a testharness.js-based test. -PASS Startup -PASS Request basic test -PASS Request default value test -PASS Request header test -PASS Request header test -PASS Request credentials test -PASS Request redirect test -PASS Request integrity test -PASS Request method name throw test -PASS Request mode throw test -PASS Request: valid method names and normalize test -PASS Request construction with URLs with credentials. -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction failure should not set "bodyUsed" -PASS Request without RequestInit. -PASS Request with referrer=about:client. -PASS Request with no-referrer. -PASS Request with a url referrer -PASS Request with a url referrer containing user, pass, and so on -PASS Request with a url with another origin -PASS Request with an invalid referrer -PASS Request with a relative referrer -PASS Referrer policy settings -PASS Referrer policy should be cleared when any members are set -FAIL Request of GET/HEAD method cannot have RequestInit body. assert_not_equals: got disallowed value undefined -PASS Used => clone -PASS Test clone behavior with loading content from Request. -PASS Request body test -PASS Request throw error test -PASS MIME type for Blob -PASS MIME type for Blob with non-empty type -PASS MIME type for FormData -PASS MIME type for USVString -PASS Extract a MIME type with clone -PASS MIME type unchanged if headers are modified after Request() constructor -PASS Extract a MIME type (1) -PASS Credentials and body can both be set. -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/workers/request-base-https-other-https-expected.txt b/third_party/WebKit/LayoutTests/http/tests/fetch/workers/request-base-https-other-https-expected.txt deleted file mode 100644 index 5da3360d..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/workers/request-base-https-other-https-expected.txt +++ /dev/null
@@ -1,41 +0,0 @@ -This is a testharness.js-based test. -PASS Startup -PASS Request basic test -PASS Request default value test -PASS Request header test -PASS Request header test -PASS Request credentials test -PASS Request redirect test -PASS Request integrity test -PASS Request method name throw test -PASS Request mode throw test -PASS Request: valid method names and normalize test -PASS Request construction with URLs with credentials. -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction failure should not set "bodyUsed" -PASS Request without RequestInit. -PASS Request with referrer=about:client. -PASS Request with no-referrer. -PASS Request with a url referrer -PASS Request with a url referrer containing user, pass, and so on -PASS Request with a url with another origin -PASS Request with an invalid referrer -PASS Request with a relative referrer -PASS Referrer policy settings -PASS Referrer policy should be cleared when any members are set -FAIL Request of GET/HEAD method cannot have RequestInit body. assert_not_equals: got disallowed value undefined -PASS Used => clone -PASS Test clone behavior with loading content from Request. -PASS Request body test -PASS Request throw error test -PASS MIME type for Blob -PASS MIME type for Blob with non-empty type -PASS MIME type for FormData -PASS MIME type for USVString -PASS Extract a MIME type with clone -PASS MIME type unchanged if headers are modified after Request() constructor -PASS Extract a MIME type (1) -PASS Credentials and body can both be set. -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/http/tests/fetch/workers/request-expected.txt b/third_party/WebKit/LayoutTests/http/tests/fetch/workers/request-expected.txt deleted file mode 100644 index 5da3360d..0000000 --- a/third_party/WebKit/LayoutTests/http/tests/fetch/workers/request-expected.txt +++ /dev/null
@@ -1,41 +0,0 @@ -This is a testharness.js-based test. -PASS Startup -PASS Request basic test -PASS Request default value test -PASS Request header test -PASS Request header test -PASS Request credentials test -PASS Request redirect test -PASS Request integrity test -PASS Request method name throw test -PASS Request mode throw test -PASS Request: valid method names and normalize test -PASS Request construction with URLs with credentials. -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction without body behavior regardning "bodyUsed" -PASS Request construction failure should not set "bodyUsed" -PASS Request without RequestInit. -PASS Request with referrer=about:client. -PASS Request with no-referrer. -PASS Request with a url referrer -PASS Request with a url referrer containing user, pass, and so on -PASS Request with a url with another origin -PASS Request with an invalid referrer -PASS Request with a relative referrer -PASS Referrer policy settings -PASS Referrer policy should be cleared when any members are set -FAIL Request of GET/HEAD method cannot have RequestInit body. assert_not_equals: got disallowed value undefined -PASS Used => clone -PASS Test clone behavior with loading content from Request. -PASS Request body test -PASS Request throw error test -PASS MIME type for Blob -PASS MIME type for Blob with non-empty type -PASS MIME type for FormData -PASS MIME type for USVString -PASS Extract a MIME type with clone -PASS MIME type unchanged if headers are modified after Request() constructor -PASS Extract a MIME type (1) -PASS Credentials and body can both be set. -Harness: the test ran to completion. -
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-preserve-expansion.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-preserve-expansion.html index 0841c95..eef7e1c 100644 --- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-preserve-expansion.html +++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/watch-expressions-preserve-expansion.html
@@ -83,7 +83,7 @@ function expandProperties(treeoutline, path, callback) { - treeoutline.addEventListener(TreeOutline.Events.ElementAttached, elementAttached); + treeoutline.addEventListener(UI.TreeOutline.Events.ElementAttached, elementAttached); treeoutline.expand(); function elementAttached(event) @@ -101,7 +101,7 @@ return; } - treeoutline.removeEventListener(TreeOutline.Events.ElementAttached, elementAttached); + treeoutline.removeEventListener(UI.TreeOutline.Events.ElementAttached, elementAttached); callback(); } }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/threaded/transitions/cancel-and-start-new-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/threaded/transitions/cancel-and-start-new-expected.txt deleted file mode 100644 index 289483a..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/virtual/threaded/transitions/cancel-and-start-new-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -Tests that having stopped a transition before it completes, a subsequent transition starts correctly. - -FAIL(was: 0, expected: 200)
diff --git a/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new-expected.txt b/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new-expected.txt deleted file mode 100644 index 3fed5c30..0000000 --- a/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -Tests that having stopped a transition before it completes, a subsequent transition starts correctly. - -PASS
diff --git a/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html b/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html index 7edcae8..c8fda79 100644 --- a/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html +++ b/third_party/WebKit/LayoutTests/transitions/cancel-and-start-new.html
@@ -1,100 +1,44 @@ <!DOCTYPE html> -<html> -<head> - <style> - #target { - position: relative; - background-color: #933; - width: 50px; - height: 50px; - top: 0px; - left: 0px; - } - #target.transition-top { - top: 400px; - transition: top 2000ms linear; - } - #target.transition-left { - left: 400px; - transition: left 2000ms linear; - } - </style> - <script> - if (window.testRunner) { - testRunner.dumpAsText(); - testRunner.waitUntilDone(); - } - - function fail(message) { - var result = "<span style='color:red'>" + message + "</span>"; - document.getElementById('result').innerHTML = result; - if (window.testRunner) - testRunner.notifyDone(); - } - - function success() { - var result = "<span style='color:green'>PASS</span>"; - document.getElementById('result').innerHTML = result; - if (window.testRunner) - testRunner.notifyDone(); - } - - function isEqual(actual, desired, tolerance) - { - var diff = Math.abs(actual - desired); - return diff < tolerance; - } - - function start() - { - document.getElementById("target").classList.add('transition-top'); - internals.pauseAnimations(1); - cancelTransition(); - } - - function cancelTransition() - { - var top = parseFloat(window.getComputedStyle(document.getElementById('target')).top); - if (isEqual(top, 200, 1)) { - document.getElementById("target").classList.remove('transition-top'); - internals.pauseAnimations(1); - startNewTransition(); - } else { - fail('top was: ' + top + ', expected: 200'); - } - } - - function startNewTransition() - { - var top = parseFloat(window.getComputedStyle(document.getElementById('target')).top); - if (isEqual(top, 0, 1)) { - document.getElementById("target").classList.add('transition-left'); - internals.pauseAnimations(1); - check(); - } else { - fail('top was: ' + top + ', expected: 0'); - } - } - - function check() - { - var left = parseFloat(window.getComputedStyle(document.getElementById('target')).left); - if (isEqual(left, 200, 1)) { - success(); - } else { - fail('left was: ' + left + ', expected: 200'); - } - } - - window.onload = start; - </script> -</head> -<body> -<p> - Tests that having stopped a transition before it completes, a subsequent - transition starts correctly. -</p> +<meta charset="utf-8"> +<script src="../resources/testharness.js"></script> +<script src="../resources/testharnessreport.js"></script> +<style> + #target { + left: 0px; + top: 0px; + } + #target.transition-top { + top: 100px; + transition: top 1s linear; + } + #target.transition-left { + left: 100px; + transition: left 50ms linear; + } +</style> <div id="target"></div> -<div id="result"></div> -</body> -</html> +<script> + 'use strict'; + function waitForNextFrame() { + return new Promise(function(resolve, reject) { + requestAnimationFrame(() => { + resolve(); + }); + }); + } + + async_test(t => { + waitForNextFrame().then(() => { + target.classList.add('transition-top'); + }).then(waitForNextFrame).then(() => { + target.classList.remove('transition-top'); + }).then(waitForNextFrame).then(t.step_func(() => { + target.classList.add('transition-left'); + assert_equals(getComputedStyle(target).top, '0px'); + assert_equals(getComputedStyle(target).left, '0px'); + target.addEventListener('transitionend', t.step_func_done(() => { + assert_equals(getComputedStyle(target).left, '100px'); + })); + })); + }, 'Having stopped a transition before it completes, a subsequent transition starts correctly'); +</script>
diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/transitions/cancel-and-start-new-expected.txt b/third_party/WebKit/LayoutTests/virtual/threaded/transitions/cancel-and-start-new-expected.txt deleted file mode 100644 index 0c20a8e..0000000 --- a/third_party/WebKit/LayoutTests/virtual/threaded/transitions/cancel-and-start-new-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -Tests that having stopped a transition before it completes, a subsequent transition starts correctly. - -FAIL(was: 66.664, expected: 200)
diff --git a/third_party/WebKit/Source/core/css/FontFace.cpp b/third_party/WebKit/Source/core/css/FontFace.cpp index 0681159e..d23fa0b 100644 --- a/third_party/WebKit/Source/core/css/FontFace.cpp +++ b/third_party/WebKit/Source/core/css/FontFace.cpp
@@ -154,12 +154,12 @@ } FontFace::FontFace(ExecutionContext* context) - : ContextLifecycleObserver(context), m_status(Unloaded) {} + : ContextClient(context), m_status(Unloaded) {} FontFace::FontFace(ExecutionContext* context, const AtomicString& family, const FontFaceDescriptors& descriptors) - : ContextLifecycleObserver(context), m_family(family), m_status(Unloaded) { + : ContextClient(context), m_family(family), m_status(Unloaded) { Document* document = toDocument(context); setPropertyFromString(document, descriptors.style(), CSSPropertyFontStyle); setPropertyFromString(document, descriptors.weight(), CSSPropertyFontWeight); @@ -635,7 +635,7 @@ visitor->trace(m_loadedProperty); visitor->trace(m_cssFontFace); visitor->trace(m_callbacks); - ContextLifecycleObserver::trace(visitor); + ContextClient::trace(visitor); } bool FontFace::hadBlankText() const {
diff --git a/third_party/WebKit/Source/core/css/FontFace.h b/third_party/WebKit/Source/core/css/FontFace.h index f4ed0f6..6924fff 100644 --- a/third_party/WebKit/Source/core/css/FontFace.h +++ b/third_party/WebKit/Source/core/css/FontFace.h
@@ -58,7 +58,7 @@ class FontFace : public GarbageCollectedFinalized<FontFace>, public ScriptWrappable, public ActiveScriptWrappable<FontFace>, - public ContextLifecycleObserver { + public ContextClient { DEFINE_WRAPPERTYPEINFO(); USING_GARBAGE_COLLECTED_MIXIN(FontFace); WTF_MAKE_NONCOPYABLE(FontFace);
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp index 77f8743..7befa59 100644 --- a/third_party/WebKit/Source/core/frame/FrameView.cpp +++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -1319,6 +1319,12 @@ void FrameView::setNeedsPaintPropertyUpdate() { m_needsPaintPropertyUpdate = true; + if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { + if (auto* layoutView = this->layoutView()) { + layoutView->setNeedsPaintPropertyUpdate(); + return; + } + } if (LayoutObject* owner = frame().ownerLayoutObject()) owner->setNeedsPaintPropertyUpdate(); } @@ -4616,6 +4622,9 @@ LayoutViewItem layoutViewItem = this->layoutViewItem(); if (!layoutViewItem.isNull()) layoutViewItem.invalidatePaintForViewAndCompositedLayers(); + // Also need to update all paint properties that might be skipped while + // the frame was throttled. + setSubtreeNeedsPaintPropertyUpdate(); } bool hasHandlers = m_frame->host() &&
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp index e14024d..593f586 100644 --- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp +++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -967,7 +967,7 @@ // If we have a layer that clips children, position it. IntRect clippingBox; - if (m_childContainmentLayer) + if (m_childContainmentLayer && layoutObject()->isBox()) clippingBox = clipBox(toLayoutBox(layoutObject())); updateChildTransformLayerGeometry(); @@ -1043,7 +1043,8 @@ const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLocation) { if (compositingContainer && - compositingContainer->compositedLayerMapping()->hasClippingLayer()) { + compositingContainer->compositedLayerMapping()->hasClippingLayer() && + compositingContainer->layoutObject()->isBox()) { // If the compositing ancestor has a layer to clip children, we parent in // that, and therefore position relative to it. IntRect clippingBox = @@ -1360,7 +1361,8 @@ } void CompositedLayerMapping::updateChildClippingMaskLayerGeometry() { - if (!m_childClippingMaskLayer || !layoutObject()->style()->clipPath()) + if (!m_childClippingMaskLayer || !layoutObject()->style()->clipPath() || + !layoutObject()->isBox()) return; LayoutBox* layoutBox = toLayoutBox(layoutObject()); IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect());
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp index 7a098e40..cb0c1fc2 100644 --- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp +++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -2420,14 +2420,13 @@ return rect; } -static inline LayoutRect flippedLogicalBoundingBox( - LayoutRect boundingBox, - LayoutObject* layoutObjects) { +static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, + LayoutObject* layoutObject) { LayoutRect result = boundingBox; - if (layoutObjects->isBox()) - toLayoutBox(layoutObjects)->flipForWritingMode(result); + if (layoutObject->isBox()) + toLayoutBox(layoutObject)->flipForWritingMode(result); else - layoutObjects->containingBlock()->flipForWritingMode(result); + layoutObject->containingBlock()->flipForWritingMode(result); return result; }
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js b/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js index e182e60..bacd90c6 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js
@@ -39,7 +39,7 @@ /** * @unrestricted */ -Accessibility.ARIAAttributesTreeElement = class extends TreeElement { +Accessibility.ARIAAttributesTreeElement = class extends UI.TreeElement { /** * @param {!Accessibility.ARIAAttributesPane} parentPane * @param {!SDK.DOMNode.Attribute} attribute
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js index 6f50e90..4830cc7 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js
@@ -144,7 +144,7 @@ /** * @unrestricted */ -Accessibility.AXNodeTreeElement = class extends TreeElement { +Accessibility.AXNodeTreeElement = class extends UI.TreeElement { /** * @param {!Accessibility.AccessibilityNode} axNode * @param {!Accessibility.AXTreePane} treePane
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityNodeView.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityNodeView.js index 88396b1..5bdfdc3b 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityNodeView.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilityNodeView.js
@@ -115,7 +115,7 @@ /** * @unrestricted */ -Accessibility.AXNodePropertyTreeElement = class extends TreeElement { +Accessibility.AXNodePropertyTreeElement = class extends UI.TreeElement { /** * @param {!Accessibility.AccessibilityNode} axNode */ @@ -481,7 +481,7 @@ /** * @unrestricted */ -Accessibility.AXRelatedNodeSourceTreeElement = class extends TreeElement { +Accessibility.AXRelatedNodeSourceTreeElement = class extends UI.TreeElement { /** * @param {{deferredNode: (!SDK.DeferredDOMNode|undefined), idref: (string|undefined)}} node * @param {!Protocol.Accessibility.AXRelatedNode=} value
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js index 56c7d8d..bac6c27 100644 --- a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js +++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js
@@ -175,10 +175,10 @@ } /** - * @return {!TreeOutline} + * @return {!UI.TreeOutline} */ createTreeOutline() { - var treeOutline = new TreeOutlineInShadow(); + var treeOutline = new UI.TreeOutlineInShadow(); treeOutline.registerRequiredCSS('accessibility/accessibilityNode.css'); treeOutline.registerRequiredCSS('components/objectValue.css');
diff --git a/third_party/WebKit/Source/devtools/front_end/audits/AuditLauncherView.js b/third_party/WebKit/Source/devtools/front_end/audits/AuditLauncherView.js index 35ef764..f573242 100644 --- a/third_party/WebKit/Source/devtools/front_end/audits/AuditLauncherView.js +++ b/third_party/WebKit/Source/devtools/front_end/audits/AuditLauncherView.js
@@ -209,7 +209,7 @@ * @param {string=} id */ _createCategoryElement(title, id) { - var labelElement = createCheckboxLabel(title); + var labelElement = UI.createCheckboxLabel(title); if (id) { labelElement.id = this._categoryIdPrefix + id; labelElement.checkboxElement.addEventListener('click', this._boundCategoryClickListener, false); @@ -248,18 +248,18 @@ this._buttonContainerElement = this._contentElement.createChild('div', 'button-container'); - var radio = createRadioLabel('audit-mode', Common.UIString('Audit Present State'), true); + var radio = UI.createRadioLabel('audit-mode', Common.UIString('Audit Present State'), true); this._buttonContainerElement.appendChild(radio); this._auditPresentStateElement = radio.radioElement; - radio = createRadioLabel('audit-mode', Common.UIString('Reload Page and Audit on Load')); + radio = UI.createRadioLabel('audit-mode', Common.UIString('Reload Page and Audit on Load')); this._buttonContainerElement.appendChild(radio); this._auditReloadedStateElement = radio.radioElement; - this._launchButton = createTextButton(Common.UIString('Run'), this._launchButtonClicked.bind(this)); + this._launchButton = UI.createTextButton(Common.UIString('Run'), this._launchButtonClicked.bind(this)); this._buttonContainerElement.appendChild(this._launchButton); - this._clearButton = createTextButton(Common.UIString('Clear'), this._clearButtonClicked.bind(this)); + this._clearButton = UI.createTextButton(Common.UIString('Clear'), this._clearButtonClicked.bind(this)); this._buttonContainerElement.appendChild(this._clearButton); this._selectAllClicked(this._selectAllCheckboxElement.checked);
diff --git a/third_party/WebKit/Source/devtools/front_end/audits/AuditResultView.js b/third_party/WebKit/Source/devtools/front_end/audits/AuditResultView.js index 442feaf..b90146a6 100644 --- a/third_party/WebKit/Source/devtools/front_end/audits/AuditResultView.js +++ b/third_party/WebKit/Source/devtools/front_end/audits/AuditResultView.js
@@ -37,7 +37,7 @@ */ constructor(categoryResult) { super(categoryResult.title); - this._treeOutline = new TreeOutlineInShadow(); + this._treeOutline = new UI.TreeOutlineInShadow(); this._treeOutline.registerRequiredCSS('audits/auditResultTree.css'); this._treeOutline.element.classList.add('audit-result-tree'); this.element.appendChild(this._treeOutline.element); @@ -61,7 +61,7 @@ } /** - * @param {!TreeElement} parentTreeNode + * @param {!UI.TreeElement} parentTreeNode * @param {!Audits.AuditRuleResult} result * @param {?Audits.AuditRule.Severity=} severity */ @@ -88,7 +88,7 @@ } titleFragment.createTextChild(title); - var treeElement = new TreeElement(titleFragment, !!result.children); + var treeElement = new UI.TreeElement(titleFragment, !!result.children); treeElement.selectable = false; parentTreeNode.appendChild(treeElement);
diff --git a/third_party/WebKit/Source/devtools/front_end/audits/AuditsPanel.js b/third_party/WebKit/Source/devtools/front_end/audits/AuditsPanel.js index 878dc02..beb6fd8 100644 --- a/third_party/WebKit/Source/devtools/front_end/audits/AuditsPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/audits/AuditsPanel.js
@@ -37,14 +37,14 @@ this.registerRequiredCSS('ui/panelEnablerView.css'); this.registerRequiredCSS('audits/auditsPanel.css'); - this._sidebarTree = new TreeOutlineInShadow(); + this._sidebarTree = new UI.TreeOutlineInShadow(); this._sidebarTree.registerRequiredCSS('audits/auditsSidebarTree.css'); this.panelSidebarElement().appendChild(this._sidebarTree.element); this._auditsItemTreeElement = new Audits.AuditsSidebarTreeElement(this); this._sidebarTree.appendChild(this._auditsItemTreeElement); - this._auditResultsTreeElement = new TreeElement(Common.UIString('RESULTS'), true); + this._auditResultsTreeElement = new UI.TreeElement(Common.UIString('RESULTS'), true); this._auditResultsTreeElement.selectable = false; this._auditResultsTreeElement.listItemElement.classList.add('audits-sidebar-results'); this._auditResultsTreeElement.expand(); @@ -451,7 +451,7 @@ /** * @unrestricted */ -Audits.AuditsSidebarTreeElement = class extends TreeElement { +Audits.AuditsSidebarTreeElement = class extends UI.TreeElement { /** * @param {!Audits.AuditsPanel} panel */ @@ -476,7 +476,7 @@ /** * @unrestricted */ -Audits.AuditResultSidebarTreeElement = class extends TreeElement { +Audits.AuditResultSidebarTreeElement = class extends UI.TreeElement { /** * @param {!Audits.AuditsPanel} panel * @param {!Array.<!Audits.AuditCategoryResult>} results
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js index 5bbc40bf..e997de2 100644 --- a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js +++ b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
@@ -8,8 +8,8 @@ constructor() { super('audits2'); this.contentElement.classList.add('vbox'); - this.contentElement.appendChild(createTextButton(Common.UIString('Start'), this._start.bind(this))); - this.contentElement.appendChild(createTextButton(Common.UIString('Stop'), this._stop.bind(this))); + this.contentElement.appendChild(UI.createTextButton(Common.UIString('Start'), this._start.bind(this))); + this.contentElement.appendChild(UI.createTextButton(Common.UIString('Stop'), this._stop.bind(this))); this._resultElement = this.contentElement.createChild('div', 'overflow-auto'); }
diff --git a/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js index 8aa4999..e1c38f0 100644 --- a/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/components/DOMBreakpointsSidebarPane.js
@@ -186,7 +186,7 @@ element._type = type; element.addEventListener('contextmenu', this._contextMenu.bind(this, node, type), true); - var checkboxLabel = createCheckboxLabel('', enabled); + var checkboxLabel = UI.createCheckboxLabel('', enabled); var checkboxElement = checkboxLabel.checkboxElement; checkboxElement.addEventListener('click', this._checkboxClicked.bind(this, node, type), false); element._checkboxElement = checkboxElement;
diff --git a/third_party/WebKit/Source/devtools/front_end/components/EventListenersView.js b/third_party/WebKit/Source/devtools/front_end/components/EventListenersView.js index 3ce8d2f..34bec39 100644 --- a/third_party/WebKit/Source/devtools/front_end/components/EventListenersView.js +++ b/third_party/WebKit/Source/devtools/front_end/components/EventListenersView.js
@@ -17,7 +17,7 @@ constructor(element, changeCallback) { this._element = element; this._changeCallback = changeCallback; - this._treeOutline = new TreeOutlineInShadow(); + this._treeOutline = new UI.TreeOutlineInShadow(); this._treeOutline.hideOverflow(); this._treeOutline.registerRequiredCSS('components/objectValue.css'); this._treeOutline.registerRequiredCSS('components/eventListenersView.css'); @@ -205,7 +205,7 @@ /** * @unrestricted */ -Components.EventListenersTreeElement = class extends TreeElement { +Components.EventListenersTreeElement = class extends UI.TreeElement { /** * @param {string} type * @param {!Components.Linkifier} linkifier @@ -220,8 +220,8 @@ } /** - * @param {!TreeElement} element1 - * @param {!TreeElement} element2 + * @param {!UI.TreeElement} element1 + * @param {!UI.TreeElement} element2 * @return {number} */ static comparator(element1, element2) { @@ -237,7 +237,7 @@ addObjectEventListener(eventListener, object) { var treeElement = new Components.ObjectEventListenerBar(eventListener, object, this._linkifier, this._changeCallback); - this.appendChild(/** @type {!TreeElement} */ (treeElement)); + this.appendChild(/** @type {!UI.TreeElement} */ (treeElement)); } }; @@ -245,7 +245,7 @@ /** * @unrestricted */ -Components.ObjectEventListenerBar = class extends TreeElement { +Components.ObjectEventListenerBar = class extends UI.TreeElement { /** * @param {!SDK.EventListener} eventListener * @param {!SDK.RemoteObject} object
diff --git a/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js b/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js index 393c6a5..030c044 100644 --- a/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js +++ b/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
@@ -268,7 +268,7 @@ this.contentElement.createChild('div', 'header').textContent = Common.UIString('Network Throttling Profiles'); - var addButton = createTextButton( + var addButton = UI.createTextButton( Common.UIString('Add custom profile...'), this._addButtonClicked.bind(this), 'add-conditions-button'); this.contentElement.appendChild(addButton);
diff --git a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js index 830e921..c600477 100644 --- a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js +++ b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js
@@ -27,7 +27,7 @@ /** * @unrestricted */ -Components.ObjectPropertiesSection = class extends TreeOutlineInShadow { +Components.ObjectPropertiesSection = class extends UI.TreeOutlineInShadow { /** * @param {!SDK.RemoteObject} object * @param {?string|!Element=} title @@ -371,7 +371,7 @@ } /** - * @return {!TreeElement} + * @return {!UI.TreeElement} */ objectTreeElement() { return this._objectTreeElement; @@ -401,7 +401,7 @@ /** * @unrestricted */ -Components.ObjectPropertiesSection.RootElement = class extends TreeElement { +Components.ObjectPropertiesSection.RootElement = class extends UI.TreeElement { /** * @param {!SDK.RemoteObject} object * @param {!Components.Linkifier=} linkifier @@ -479,7 +479,7 @@ /** * @unrestricted */ -Components.ObjectPropertyTreeElement = class extends TreeElement { +Components.ObjectPropertyTreeElement = class extends UI.TreeElement { /** * @param {!SDK.RemoteObjectProperty} property * @param {!Components.Linkifier=} linkifier @@ -497,7 +497,7 @@ } /** - * @param {!TreeElement} treeElement + * @param {!UI.TreeElement} treeElement * @param {!SDK.RemoteObject} value * @param {boolean} skipProto * @param {!Components.Linkifier=} linkifier @@ -545,7 +545,7 @@ } /** - * @param {!TreeElement} treeNode + * @param {!UI.TreeElement} treeNode * @param {!Array.<!SDK.RemoteObjectProperty>} properties * @param {?Array.<!SDK.RemoteObjectProperty>} internalProperties * @param {boolean} skipProto @@ -608,7 +608,7 @@ } /** - * @param {!TreeElement} treeNode + * @param {!UI.TreeElement} treeNode * @param {?string=} emptyPlaceholder */ static _appendEmptyPlaceholderIfNeeded(treeNode, emptyPlaceholder) { @@ -616,7 +616,7 @@ return; var title = createElementWithClass('div', 'gray-info-message'); title.textContent = emptyPlaceholder || Common.UIString('No Properties'); - var infoElement = new TreeElement(title); + var infoElement = new UI.TreeElement(title); treeNode.appendChild(infoElement); } @@ -959,7 +959,7 @@ /** * @unrestricted */ -Components.ArrayGroupingTreeElement = class extends TreeElement { +Components.ArrayGroupingTreeElement = class extends UI.TreeElement { /** * @param {!SDK.RemoteObject} object * @param {number} fromIndex @@ -980,7 +980,7 @@ } /** - * @param {!TreeElement} treeNode + * @param {!UI.TreeElement} treeNode * @param {!SDK.RemoteObject} object * @param {number} fromIndex * @param {number} toIndex @@ -991,7 +991,7 @@ } /** - * @param {!TreeElement} treeNode + * @param {!UI.TreeElement} treeNode * @param {!SDK.RemoteObject} object * @param {number} fromIndex * @param {number} toIndex @@ -1111,7 +1111,7 @@ } /** - * @param {!TreeElement} treeNode + * @param {!UI.TreeElement} treeNode * @param {!SDK.RemoteObject} object * @param {number} fromIndex * @param {number} toIndex @@ -1177,7 +1177,7 @@ } /** - * @param {!TreeElement} treeNode + * @param {!UI.TreeElement} treeNode * @param {!SDK.RemoteObject} object * @param {boolean} skipGetOwnPropertyNames * @param {!Components.Linkifier=} linkifier @@ -1287,9 +1287,9 @@ * @param {!Components.ObjectPropertiesSection} section */ watchSection(id, section) { - section.addEventListener(TreeOutline.Events.ElementAttached, this._elementAttached, this); - section.addEventListener(TreeOutline.Events.ElementExpanded, this._elementExpanded, this); - section.addEventListener(TreeOutline.Events.ElementCollapsed, this._elementCollapsed, this); + section.addEventListener(UI.TreeOutline.Events.ElementAttached, this._elementAttached, this); + section.addEventListener(UI.TreeOutline.Events.ElementExpanded, this._elementExpanded, this); + section.addEventListener(UI.TreeOutline.Events.ElementCollapsed, this._elementCollapsed, this); section[Components.ObjectPropertiesSectionExpandController._treeOutlineId] = id; if (this._expandedProperties.has(id)) @@ -1310,7 +1310,7 @@ * @param {!Common.Event} event */ _elementAttached(event) { - var element = /** @type {!TreeElement} */ (event.data); + var element = /** @type {!UI.TreeElement} */ (event.data); if (element.isExpandable() && this._expandedProperties.has(this._propertyPath(element))) element.expand(); } @@ -1319,7 +1319,7 @@ * @param {!Common.Event} event */ _elementExpanded(event) { - var element = /** @type {!TreeElement} */ (event.data); + var element = /** @type {!UI.TreeElement} */ (event.data); this._expandedProperties.add(this._propertyPath(element)); } @@ -1327,12 +1327,12 @@ * @param {!Common.Event} event */ _elementCollapsed(event) { - var element = /** @type {!TreeElement} */ (event.data); + var element = /** @type {!UI.TreeElement} */ (event.data); this._expandedProperties.delete(this._propertyPath(element)); } /** - * @param {!TreeElement} treeElement + * @param {!UI.TreeElement} treeElement * @return {string} */ _propertyPath(treeElement) {
diff --git a/third_party/WebKit/Source/devtools/front_end/components_lazy/FilmStripView.js b/third_party/WebKit/Source/devtools/front_end/components_lazy/FilmStripView.js index 6318a74a1..a4dd395 100644 --- a/third_party/WebKit/Source/devtools/front_end/components_lazy/FilmStripView.js +++ b/third_party/WebKit/Source/devtools/front_end/components_lazy/FilmStripView.js
@@ -224,10 +224,11 @@ var footerElement = this.contentElement.createChild('div', 'filmstrip-dialog-footer'); footerElement.createChild('div', 'flex-auto'); var prevButton = - createTextButton('\u25C0', this._onPrevFrame.bind(this), undefined, Common.UIString('Previous frame')); + UI.createTextButton('\u25C0', this._onPrevFrame.bind(this), undefined, Common.UIString('Previous frame')); footerElement.appendChild(prevButton); this._timeLabel = footerElement.createChild('div', 'filmstrip-dialog-label'); - var nextButton = createTextButton('\u25B6', this._onNextFrame.bind(this), undefined, Common.UIString('Next frame')); + var nextButton = + UI.createTextButton('\u25B6', this._onNextFrame.bind(this), undefined, Common.UIString('Next frame')); footerElement.appendChild(nextButton); footerElement.createChild('div', 'flex-auto');
diff --git a/third_party/WebKit/Source/devtools/front_end/css_tracker/CSSTrackerView.js b/third_party/WebKit/Source/devtools/front_end/css_tracker/CSSTrackerView.js index d94adb0..51049b4 100644 --- a/third_party/WebKit/Source/devtools/front_end/css_tracker/CSSTrackerView.js +++ b/third_party/WebKit/Source/devtools/front_end/css_tracker/CSSTrackerView.js
@@ -11,9 +11,8 @@ var toolbarContainer = this.contentElement.createChild('div', 'css-tracker-toolbar-container'); var topToolbar = new UI.Toolbar('css-tracker-toolbar', toolbarContainer); - this._recordButton = new UI.ToolbarToggle(Common.UIString('Start recording'), - 'largeicon-resume', - 'largeicon-pause'); + this._recordButton = + new UI.ToolbarToggle(Common.UIString('Start recording'), 'largeicon-resume', 'largeicon-pause'); this._recordButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._toggleRecording(!this._isRecording)); topToolbar.appendToolbarItem(this._recordButton); @@ -23,7 +22,7 @@ this._cssResultsElement = this.contentElement.createChild('div', 'css-results'); this._progressElement = this._cssResultsElement.createChild('div', 'progress-view'); - this._treeOutline = new TreeOutlineInShadow(); + this._treeOutline = new UI.TreeOutlineInShadow(); this._treeOutline.registerRequiredCSS('css_tracker/unusedRulesTree.css'); this._statusToolbarElement = this.contentElement.createChild('div', 'css-toolbar-summary'); @@ -105,17 +104,16 @@ var gutterRange = Common.TextRange.fromObject(rule.range); if (gutterRange.startColumn) gutterRange.startColumn--; - uiSourceCode.addDecoration(gutterRange, - CSSTracker.CSSTrackerView.LineDecorator.type, rule.wasUsed); + uiSourceCode.addDecoration(gutterRange, CSSTracker.CSSTrackerView.LineDecorator.type, rule.wasUsed); } var percentUnused = Math.round(100 * unusedRulesCount / ruleUsageList.length); if (unusedRulesCount === 1) { this._statusMessageElement.textContent = - Common.UIString('%d CSS rule is not used. (%d%%)', unusedRulesCount, percentUnused); + Common.UIString('%d CSS rule is not used. (%d%%)', unusedRulesCount, percentUnused); } else { this._statusMessageElement.textContent = Common.UIString('%d CSS rules are not used. (%d%%)', unusedRulesCount, percentUnused); - } + } this._renderRuleUsage(cssModel, ruleUsageList); } @@ -203,16 +201,15 @@ if (unattributedRulesCount) { if (unattributedRulesCount === 1) { var removedStyleSheetStats = Common.UIString('1 unused rule in a removed style sheet.'); - } - else { + } else { var removedStyleSheetStats = Common.UIString('%d unused rules in removed style sheets.', unattributedRulesCount); } - var treeElement = new TreeElement(Common.UIString('Unknown style sheets'), true); + var treeElement = new UI.TreeElement(Common.UIString('Unknown style sheets'), true); treeElement.toggleOnClick = true; treeElement.selectable = false; - var stats = new TreeElement(removedStyleSheetStats, false); + var stats = new UI.TreeElement(removedStyleSheetStats, false); stats.selectable = false; treeElement.appendChild(stats); this._treeOutline.appendChild(treeElement); @@ -236,8 +233,7 @@ startPosition = i; } var url = this._urlForStyleSheetId(cssModel, ruleList[startPosition].styleSheetId); - var styleSheetTreeElement = - new CSSTracker.CSSTrackerView.StyleSheetTreeElement(url, ruleList.slice(startPosition)); + var styleSheetTreeElement = new CSSTracker.CSSTrackerView.StyleSheetTreeElement(url, ruleList.slice(startPosition)); this._treeOutline.appendChild(styleSheetTreeElement); } @@ -266,7 +262,7 @@ CSSTracker.CSSTrackerView._rulesShownAtOnce = 20; -CSSTracker.CSSTrackerView.StyleSheetTreeElement = class extends TreeElement { +CSSTracker.CSSTrackerView.StyleSheetTreeElement = class extends UI.TreeElement { /** * @param {string} url * @param {!Array<!CSSTracker.RuleUsage>} ruleList @@ -293,7 +289,7 @@ this.toggleOnClick = true; this.selectable = false; - /** @type {?TreeElement} */ + /** @type {?UI.TreeElement} */ this._showAllRulesTreeElement = null; var title = createElementWithClass('div', 'rule-result'); @@ -354,7 +350,7 @@ var contentSpan = anchor.createChild('span', 'rule-match-content'); contentSpan.textContent = rule.selector; - var ruleElement = new TreeElement(); + var ruleElement = new UI.TreeElement(); ruleElement.selectable = true; this.appendChild(ruleElement); ruleElement.listItemElement.className = 'rule-match source-code'; @@ -367,9 +363,9 @@ */ _appendShowAllRulesButton(startMatchIndex) { var rulesLeftCount = this._unusedRules.length - startMatchIndex; - var button = createTextButton('', this._showMoreRulesElementSelected.bind(this, startMatchIndex)); + var button = UI.createTextButton('', this._showMoreRulesElementSelected.bind(this, startMatchIndex)); button.textContent = Common.UIString('Show all rules (%d more).', rulesLeftCount); - this._showAllRulesTreeElement = new TreeElement(button); + this._showAllRulesTreeElement = new UI.TreeElement(button); this._showAllRulesTreeElement.selectable = false; this.appendChild(this._showAllRulesTreeElement); }
diff --git a/third_party/WebKit/Source/devtools/front_end/devices/DevicesView.js b/third_party/WebKit/Source/devtools/front_end/devices/DevicesView.js index 85d3d6f..f5771ce 100644 --- a/third_party/WebKit/Source/devtools/front_end/devices/DevicesView.js +++ b/third_party/WebKit/Source/devtools/front_end/devices/DevicesView.js
@@ -210,7 +210,7 @@ this.contentElement.createChild('div', 'hbox device-text-row').createChild('div', 'view-title').textContent = Common.UIString('Settings'); - var discoverUsbDevicesCheckbox = createCheckboxLabel(Common.UIString('Discover USB devices')); + var discoverUsbDevicesCheckbox = UI.createCheckboxLabel(Common.UIString('Discover USB devices')); discoverUsbDevicesCheckbox.classList.add('usb-checkbox'); this.element.appendChild(discoverUsbDevicesCheckbox); this._discoverUsbDevicesCheckbox = discoverUsbDevicesCheckbox.checkboxElement; @@ -223,7 +223,7 @@ Common.UIString('remote debugging documentation.'))); var portForwardingHeader = this.element.createChild('div', 'port-forwarding-header'); - var portForwardingEnabledCheckbox = createCheckboxLabel(Common.UIString('Port forwarding')); + var portForwardingEnabledCheckbox = UI.createCheckboxLabel(Common.UIString('Port forwarding')); portForwardingEnabledCheckbox.classList.add('port-forwarding-checkbox'); portForwardingHeader.appendChild(portForwardingEnabledCheckbox); this._portForwardingEnabledCheckbox = portForwardingEnabledCheckbox.checkboxElement; @@ -244,7 +244,7 @@ this._list.show(this.element); this.element.appendChild( - createTextButton(Common.UIString('Add rule'), this._addRuleButtonClicked.bind(this), 'add-rule-button')); + UI.createTextButton(Common.UIString('Add rule'), this._addRuleButtonClicked.bind(this), 'add-rule-button')); /** @type {!Array<!Adb.PortForwardingRule>} */ this._portForwardingConfig = []; @@ -473,7 +473,7 @@ newTabInput.type = 'text'; newTabInput.placeholder = Common.UIString('Enter URL'); newTabInput.addEventListener('keydown', newTabKeyDown, false); - var newTabButton = createTextButton(Common.UIString('Open'), openNewTab); + var newTabButton = UI.createTextButton(Common.UIString('Open'), openNewTab); newTabRow.appendChild(newTabButton); var pages = element.createChild('div', 'device-page-list vbox'); @@ -575,7 +575,8 @@ var titleRow = element.createChild('div', 'device-page-title-row'); var title = titleRow.createChild('div', 'device-page-title'); - var inspect = createTextButton(Common.UIString('Inspect'), doAction.bind(null, 'inspect'), 'device-inspect-button'); + var inspect = + UI.createTextButton(Common.UIString('Inspect'), doAction.bind(null, 'inspect'), 'device-inspect-button'); titleRow.appendChild(inspect); var toolbar = new UI.Toolbar('');
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ClassesPaneWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/ClassesPaneWidget.js index ffa2f03..6e94cb2 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ClassesPaneWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ClassesPaneWidget.js
@@ -96,7 +96,7 @@ keys.sort(String.caseInsensetiveComparator); for (var i = 0; i < keys.length; ++i) { var className = keys[i]; - var label = createCheckboxLabel(className, classes.get(className)); + var label = UI.createCheckboxLabel(className, classes.get(className)); label.visualizeFocus = true; label.classList.add('monospace'); label.checkboxElement.addEventListener('click', this._onClick.bind(this, className), false);
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js index 767b3c3..4479140 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js
@@ -57,7 +57,7 @@ toolbar.appendToolbarItem(new UI.ToolbarCheckbox( Common.UIString('Show all'), undefined, this._showInheritedComputedStylePropertiesSetting)); - this._propertiesOutline = new TreeOutlineInShadow(); + this._propertiesOutline = new UI.TreeOutlineInShadow(); this._propertiesOutline.hideOverflow(); this._propertiesOutline.registerRequiredCSS('elements/computedStyleSidebarPane.css'); this._propertiesOutline.element.classList.add('monospace', 'computed-properties'); @@ -184,7 +184,7 @@ semicolon.textContent = ';'; propertyValueElement.appendChild(semicolon); - var treeElement = new TreeElement(); + var treeElement = new UI.TreeElement(); treeElement.selectable = false; treeElement.title = propertyElement; treeElement[Elements.ComputedStyleWidget._propertySymbol] = {name: propertyName, value: propertyValue}; @@ -222,7 +222,7 @@ } /** - * @param {!TreeElement} treeElement + * @param {!UI.TreeElement} treeElement * @param {!Event} event */ function handleClick(treeElement, event) { @@ -247,7 +247,7 @@ * @param {!SDK.CSSModel} cssModel * @param {!SDK.CSSMatchedStyles} matchedStyles * @param {!SDK.DOMNode} node - * @param {!TreeElement} rootTreeElement + * @param {!UI.TreeElement} rootTreeElement * @param {!Array<!SDK.CSSProperty>} tracedProperties * @return {!SDK.CSSProperty} */ @@ -284,7 +284,7 @@ selectorElement.textContent = rule ? rule.selectorText() : 'element.style'; selectorElement.title = selectorElement.textContent; - var traceTreeElement = new TreeElement(); + var traceTreeElement = new UI.TreeElement(); traceTreeElement.title = trace; traceTreeElement.selectable = false; rootTreeElement.appendChild(traceTreeElement);
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementStatePaneWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementStatePaneWidget.js index 10c8b9f..4ecbcb5 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ElementStatePaneWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementStatePaneWidget.js
@@ -30,7 +30,7 @@ */ function createCheckbox(state) { var td = createElement('td'); - var label = createCheckboxLabel(':' + state); + var label = UI.createCheckboxLabel(':' + state); var input = label.checkboxElement; input.state = state; input.addEventListener('click', clickListener, false);
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js index 56309c5..6433cfd 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
@@ -31,7 +31,7 @@ /** * @unrestricted */ -Elements.ElementsTreeElement = class extends TreeElement { +Elements.ElementsTreeElement = class extends UI.TreeElement { /** * @param {!SDK.DOMNode} node * @param {boolean=} elementCloseTag @@ -278,7 +278,7 @@ * @override */ expandRecursively() { - this._node.getSubtree(-1, TreeElement.prototype.expandRecursively.bind(this, Number.MAX_VALUE)); + this._node.getSubtree(-1, UI.TreeElement.prototype.expandRecursively.bind(this, Number.MAX_VALUE)); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElementHighlighter.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElementHighlighter.js index 4452935d..f8d7034 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElementHighlighter.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElementHighlighter.js
@@ -11,8 +11,8 @@ constructor(treeOutline) { this._throttler = new Common.Throttler(100); this._treeOutline = treeOutline; - this._treeOutline.addEventListener(TreeOutline.Events.ElementExpanded, this._clearState, this); - this._treeOutline.addEventListener(TreeOutline.Events.ElementCollapsed, this._clearState, this); + this._treeOutline.addEventListener(UI.TreeOutline.Events.ElementExpanded, this._clearState, this); + this._treeOutline.addEventListener(UI.TreeOutline.Events.ElementCollapsed, this._clearState, this); this._treeOutline.addEventListener(Elements.ElementsTreeOutline.Events.SelectedNodeChanged, this._clearState, this); SDK.targetManager.addModelListener( SDK.DOMModel, SDK.DOMModel.Events.NodeHighlightedInOverlay, this._highlightNode, this);
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js index d26ca6d1..9fbb12ad 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeOutline.js
@@ -31,7 +31,7 @@ /** * @unrestricted */ -Elements.ElementsTreeOutline = class extends TreeOutline { +Elements.ElementsTreeOutline = class extends UI.TreeOutline { /** * @param {!SDK.DOMModel} domModel * @param {boolean=} omitRootDOMNode @@ -426,7 +426,7 @@ /** * @param {?SDK.DOMNode} node - * @return {?TreeElement} + * @return {?UI.TreeElement} */ _lookUpTreeElement(node) { if (!node) @@ -498,7 +498,7 @@ } /** - * @return {?TreeElement} + * @return {?UI.TreeElement} */ _treeElementFromEvent(event) { var scrollContainer = this.element.parentElement; @@ -608,7 +608,7 @@ } /** - * @param {?TreeElement} treeElement + * @param {?UI.TreeElement} treeElement */ setHoverEffect(treeElement) { if (this._previousHoveredElement === treeElement) @@ -700,7 +700,7 @@ } /** - * @param {?TreeElement} treeElement + * @param {?UI.TreeElement} treeElement * @return {boolean} */ _isValidDragSourceOrTarget(treeElement) { @@ -726,7 +726,7 @@ } /** - * @param {!TreeElement} treeElement + * @param {!UI.TreeElement} treeElement */ _doMove(treeElement) { if (!this._treeElementBeingDragged) @@ -1278,9 +1278,9 @@ * @param {!Elements.ElementsTreeElement} treeElement */ _createExpandAllButtonTreeElement(treeElement) { - var button = createTextButton('', handleLoadAllChildren.bind(this)); + var button = UI.createTextButton('', handleLoadAllChildren.bind(this)); button.value = ''; - var expandAllButtonElement = new TreeElement(button); + var expandAllButtonElement = new UI.TreeElement(button); expandAllButtonElement.selectable = false; expandAllButtonElement.expandAllButton = true; expandAllButtonElement.button = button; @@ -1633,7 +1633,7 @@ /** * @unrestricted */ -Elements.ElementsTreeOutline.ShortcutTreeElement = class extends TreeElement { +Elements.ElementsTreeOutline.ShortcutTreeElement = class extends UI.TreeElement { /** * @param {!SDK.DOMNodeShortcut} nodeShortcut */
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/PropertiesWidget.js b/third_party/WebKit/Source/devtools/front_end/elements/PropertiesWidget.js index d9389b7..1bf84cd6 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/PropertiesWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/PropertiesWidget.js
@@ -143,7 +143,7 @@ this.element.appendChild(section.element); if (expanded[this.sections.length - 1]) section.expand(); - section.addEventListener(TreeOutline.Events.ElementExpanded, this._propertyExpanded, this); + section.addEventListener(UI.TreeOutline.Events.ElementExpanded, this._propertyExpanded, this); } } } @@ -154,7 +154,7 @@ _propertyExpanded(event) { Host.userMetrics.actionTaken(Host.UserMetrics.Action.DOMPropertiesExpanded); for (var section of this.sections) - section.removeEventListener(TreeOutline.Events.ElementExpanded, this._propertyExpanded, this); + section.removeEventListener(UI.TreeOutline.Events.ElementExpanded, this._propertyExpanded, this); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js index 4d18ad3..30e0ebbe 100644 --- a/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js
@@ -574,7 +574,7 @@ this._titleElement = this.element.createChild('div', 'styles-section-title ' + (rule ? 'styles-selector' : '')); - this.propertiesTreeOutline = new TreeOutlineInShadow(); + this.propertiesTreeOutline = new UI.TreeOutlineInShadow(); this.propertiesTreeOutline.registerRequiredCSS('elements/stylesSectionTree.css'); this.propertiesTreeOutline.element.classList.add('style-properties', 'matched-styles', 'monospace'); this.propertiesTreeOutline.section = this; @@ -1762,7 +1762,7 @@ /** * @unrestricted */ -Elements.StylePropertyTreeElement = class extends TreeElement { +Elements.StylePropertyTreeElement = class extends UI.TreeElement { /** * @param {!Elements.StylesSidebarPane} stylesPane * @param {!SDK.CSSMatchedStyles} matchedStyles
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/DevicesSettingsTab.js b/third_party/WebKit/Source/devtools/front_end/emulation/DevicesSettingsTab.js index 7ab55da..2312000 100644 --- a/third_party/WebKit/Source/devtools/front_end/emulation/DevicesSettingsTab.js +++ b/third_party/WebKit/Source/devtools/front_end/emulation/DevicesSettingsTab.js
@@ -18,7 +18,8 @@ .createChild('div', 'settings-tab help-content help-container'); var buttonsRow = this.containerElement.createChild('div', 'devices-button-row'); - this._addCustomButton = createTextButton(Common.UIString('Add custom device...'), this._addCustomDevice.bind(this)); + this._addCustomButton = + UI.createTextButton(Common.UIString('Add custom device...'), this._addCustomDevice.bind(this)); buttonsRow.appendChild(this._addCustomButton); this._list = new UI.ListWidget(this);
diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/SensorsView.js b/third_party/WebKit/Source/devtools/front_end/emulation/SensorsView.js index 416ba44..b3dc736 100644 --- a/third_party/WebKit/Source/devtools/front_end/emulation/SensorsView.js +++ b/third_party/WebKit/Source/devtools/front_end/emulation/SensorsView.js
@@ -324,7 +324,7 @@ this._gammaSetter = this._createAxisInput(cellElement, this._gammaElement, Common.UIString('\u03B3 (gamma)')); this._gammaSetter(String(deviceOrientation.gamma)); - cellElement.appendChild(createTextButton( + cellElement.appendChild(UI.createTextButton( Common.UIString('Reset'), this._resetDeviceOrientation.bind(this), 'orientation-reset-button')); return fieldsetElement; }
diff --git a/third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js b/third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js index 14d426c..7b024cf9 100644 --- a/third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js +++ b/third_party/WebKit/Source/devtools/front_end/host/InspectorFrontendHost.js
@@ -421,7 +421,7 @@ /** * @unrestricted */ -var InspectorFrontendAPIImpl = class { +Host.InspectorFrontendAPIImpl = class { constructor() { this._debugFrontend = !!Runtime.queryParam('debugFrontend') || (window['InspectorTest'] && window['InspectorTest']['debugTest']); @@ -514,7 +514,7 @@ // FIXME: This file is included into both apps, since the devtools_app needs the InspectorFrontendHostAPI only, // so the host instance should not initialized there. initializeInspectorFrontendHost(); - window.InspectorFrontendAPI = new InspectorFrontendAPIImpl(); + window.InspectorFrontendAPI = new Host.InspectorFrontendAPIImpl(); Common.setLocalizationPlatform(InspectorFrontendHost.platform()); })();
diff --git a/third_party/WebKit/Source/devtools/front_end/layer_viewer/LayerTreeOutline.js b/third_party/WebKit/Source/devtools/front_end/layer_viewer/LayerTreeOutline.js index 8a650cb..98fb159 100644 --- a/third_party/WebKit/Source/devtools/front_end/layer_viewer/LayerTreeOutline.js +++ b/third_party/WebKit/Source/devtools/front_end/layer_viewer/LayerTreeOutline.js
@@ -40,7 +40,7 @@ this._layerViewHost = layerViewHost; this._layerViewHost.registerView(this); - this._treeOutline = new TreeOutlineInShadow(); + this._treeOutline = new UI.TreeOutlineInShadow(); this._treeOutline.element.classList.add('layer-tree', 'overflow-auto'); this._treeOutline.element.addEventListener('mousemove', this._onMouseMove.bind(this), false); this._treeOutline.element.addEventListener('mouseout', this._onMouseMove.bind(this), false); @@ -192,7 +192,7 @@ } /** - * @param {?TreeElement} node + * @param {?UI.TreeElement} node * @return {?LayerViewer.LayerView.Selection} */ _selectionForNode(node) { @@ -203,7 +203,7 @@ /** * @unrestricted */ -LayerViewer.LayerTreeElement = class extends TreeElement { +LayerViewer.LayerTreeElement = class extends UI.TreeElement { /** * @param {!LayerViewer.LayerTreeOutline} tree * @param {!SDK.Layer} layer
diff --git a/third_party/WebKit/Source/devtools/front_end/layer_viewer/PaintProfilerView.js b/third_party/WebKit/Source/devtools/front_end/layer_viewer/PaintProfilerView.js index c391b8a..bce1b15 100644 --- a/third_party/WebKit/Source/devtools/front_end/layer_viewer/PaintProfilerView.js +++ b/third_party/WebKit/Source/devtools/front_end/layer_viewer/PaintProfilerView.js
@@ -363,7 +363,7 @@ this.setMinimumSize(100, 25); this.element.classList.add('overflow-auto'); - this._treeOutline = new TreeOutlineInShadow(); + this._treeOutline = new UI.TreeOutlineInShadow(); this.element.appendChild(this._treeOutline.element); this._log = []; @@ -434,7 +434,7 @@ /** * @unrestricted */ -LayerViewer.LogTreeElement = class extends TreeElement { +LayerViewer.LogTreeElement = class extends UI.TreeElement { /** * @param {!LayerViewer.PaintProfilerCommandLogView} ownerView * @param {!SDK.PaintProfilerLogItem} logItem @@ -506,7 +506,7 @@ /** * @unrestricted */ -LayerViewer.LogPropertyTreeElement = class extends TreeElement { +LayerViewer.LogPropertyTreeElement = class extends UI.TreeElement { /** * @param {!{name: string, value}} property */ @@ -516,7 +516,7 @@ } /** - * @param {!TreeElement} element + * @param {!UI.TreeElement} element * @param {string} name * @param {*} value */
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js index c8fe3c8e..23660a1 100644 --- a/third_party/WebKit/Source/devtools/front_end/main/Main.js +++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -867,7 +867,7 @@ message.createChild('span', 'reason').textContent = reason; this.contentElement.createChild('div', 'message').textContent = Common.UIString('Reconnect when ready by reopening DevTools.'); - var button = createTextButton(Common.UIString('Reconnect DevTools'), () => window.location.reload()); + var button = UI.createTextButton(Common.UIString('Reconnect DevTools'), () => window.location.reload()); this.contentElement.createChild('div', 'button').appendChild(button); }
diff --git a/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js b/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js index 0631269..ca524b4 100644 --- a/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js +++ b/third_party/WebKit/Source/devtools/front_end/main/RenderingOptions.js
@@ -57,7 +57,8 @@ }, { label: Common.UIString('Scrolling Performance Issues'), - subtitle: Common.UIString('Highlights elements (teal) that can slow down scrolling, including touch & wheel event handlers and other main-thread scrolling situations.'), + subtitle: Common.UIString( + 'Highlights elements (teal) that can slow down scrolling, including touch & wheel event handlers and other main-thread scrolling situations.'), setterName: 'setShowScrollBottleneckRects' } ]; @@ -67,7 +68,7 @@ this.contentElement.createChild('div').classList.add('panel-section-separator'); var cssMediaSubtitle = Common.UIString('Forces media type for testing print and screen styles'); - var checkboxLabel = createCheckboxLabel(Common.UIString('Emulate CSS Media'), false, cssMediaSubtitle); + var checkboxLabel = UI.createCheckboxLabel(Common.UIString('Emulate CSS Media'), false, cssMediaSubtitle); this._mediaCheckbox = checkboxLabel.checkboxElement; this._mediaCheckbox.addEventListener('click', this._mediaToggled.bind(this), false); this.contentElement.appendChild(checkboxLabel); @@ -97,7 +98,7 @@ * @param {string=} subtitle */ _appendCheckbox(label, setterName, subtitle) { - var checkboxLabel = createCheckboxLabel(label, false, subtitle); + var checkboxLabel = UI.createCheckboxLabel(label, false, subtitle); this._settings.set(setterName, checkboxLabel.checkboxElement); checkboxLabel.checkboxElement.addEventListener('click', this._settingToggled.bind(this, setterName)); this.contentElement.appendChild(checkboxLabel);
diff --git a/third_party/WebKit/Source/devtools/front_end/network/JSONView.js b/third_party/WebKit/Source/devtools/front_end/network/JSONView.js index 2b77d45..cca28b5 100644 --- a/third_party/WebKit/Source/devtools/front_end/network/JSONView.js +++ b/third_party/WebKit/Source/devtools/front_end/network/JSONView.js
@@ -46,7 +46,7 @@ this._treeOutline; /** @type {number} */ this._currentSearchFocusIndex = 0; - /** @type {!Array.<!TreeElement>} */ + /** @type {!Array.<!UI.TreeElement>} */ this._currentSearchTreeElements = []; /** @type {?RegExp} */ this._searchRegex = null;
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js index caa4d5d..9ecb71a 100644 --- a/third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js +++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkConfigView.js
@@ -115,7 +115,7 @@ _createUserAgentSection() { var section = this._createSection(Common.UIString('User agent'), 'network-config-ua'); - var checkboxLabel = createCheckboxLabel(Common.UIString('Select automatically'), true); + var checkboxLabel = UI.createCheckboxLabel(Common.UIString('Select automatically'), true); section.appendChild(checkboxLabel); this._autoCheckbox = checkboxLabel.checkboxElement; this._autoCheckbox.addEventListener('change', this._userAgentTypeChanged.bind(this));
diff --git a/third_party/WebKit/Source/devtools/front_end/network/NetworkManageCustomHeadersView.js b/third_party/WebKit/Source/devtools/front_end/network/NetworkManageCustomHeadersView.js index a85253b..b46f0c1de 100644 --- a/third_party/WebKit/Source/devtools/front_end/network/NetworkManageCustomHeadersView.js +++ b/third_party/WebKit/Source/devtools/front_end/network/NetworkManageCustomHeadersView.js
@@ -29,8 +29,8 @@ placeholder.textContent = Common.UIString('No custom headers'); this._list.setEmptyPlaceholder(placeholder); this._list.show(this.contentElement); - this.contentElement.appendChild( - createTextButton(Common.UIString('Add custom header\u2026'), this._addButtonClicked.bind(this), 'add-button')); + this.contentElement.appendChild(UI.createTextButton( + Common.UIString('Add custom header\u2026'), this._addButtonClicked.bind(this), 'add-button')); /** @type {!Map.<string, !{title: string, editable: boolean}>} */ this._columnConfigs = new Map();
diff --git a/third_party/WebKit/Source/devtools/front_end/network/RequestHeadersView.js b/third_party/WebKit/Source/devtools/front_end/network/RequestHeadersView.js index d8e03ed9..9ad8fa6 100644 --- a/third_party/WebKit/Source/devtools/front_end/network/RequestHeadersView.js +++ b/third_party/WebKit/Source/devtools/front_end/network/RequestHeadersView.js
@@ -45,7 +45,7 @@ this._showRequestHeadersText = false; this._showResponseHeadersText = false; - var root = new TreeOutlineInShadow(); + var root = new UI.TreeOutlineInShadow(); root.registerRequiredCSS('network/requestHeadersTree.css'); root.element.classList.add('request-headers-tree'); root.setFocusable(false); @@ -179,14 +179,14 @@ } /** - * @param {!TreeElement} treeElement + * @param {!UI.TreeElement} treeElement * @param {?string} sourceText */ _populateTreeElementWithSourceText(treeElement, sourceText) { var sourceTextElement = createElementWithClass('span', 'header-value source-code'); sourceTextElement.textContent = String(sourceText || '').trim(); - var sourceTreeElement = new TreeElement(sourceTextElement); + var sourceTreeElement = new UI.TreeElement(sourceTextElement); sourceTreeElement.selectable = false; treeElement.removeChildren(); treeElement.appendChild(sourceTreeElement); @@ -196,7 +196,7 @@ * @param {string} title * @param {?Array.<!SDK.NetworkRequest.NameValue>} params * @param {?string} sourceText - * @param {!TreeElement} paramsTreeElement + * @param {!UI.TreeElement} paramsTreeElement */ _refreshParams(title, params, sourceText, paramsTreeElement) { paramsTreeElement.removeChildren(); @@ -244,7 +244,7 @@ this._formatParameter(Common.UIString('(empty)'), 'empty-request-header', this._decodeRequestParameters)); } - var paramTreeElement = new TreeElement(paramNameValue); + var paramTreeElement = new UI.TreeElement(paramNameValue); paramTreeElement.selectable = false; paramsTreeElement.appendChild(paramTreeElement); } @@ -280,7 +280,7 @@ var section = new Components.ObjectPropertiesSection(object, object.description); section.expand(); section.editable = false; - treeElement.appendChild(new TreeElement(section.element)); + treeElement.appendChild(new UI.TreeElement(section.element)); } } @@ -387,7 +387,7 @@ /** * @param {string} title - * @param {!TreeElement} headersTreeElement + * @param {!UI.TreeElement} headersTreeElement * @param {number} headersLength */ _refreshHeadersTitle(title, headersTreeElement, headersLength) { @@ -401,7 +401,7 @@ /** * @param {string} title * @param {!Array.<!SDK.NetworkRequest.NameValue>} headers - * @param {!TreeElement} headersTreeElement + * @param {!UI.TreeElement} headersTreeElement * @param {boolean=} provisionalHeaders */ _refreshHeaders(title, headers, headersTreeElement, provisionalHeaders) { @@ -415,14 +415,14 @@ var cautionFragment = createDocumentFragment(); cautionFragment.createChild('label', '', 'dt-icon-label').type = 'smallicon-warning'; cautionFragment.createChild('div', 'caution').textContent = cautionText; - var cautionTreeElement = new TreeElement(cautionFragment); + var cautionTreeElement = new UI.TreeElement(cautionFragment); cautionTreeElement.selectable = false; headersTreeElement.appendChild(cautionTreeElement); } headersTreeElement.hidden = !length && !provisionalHeaders; for (var i = 0; i < length; ++i) { - var headerTreeElement = new TreeElement(this._formatHeader(headers[i].name, headers[i].value)); + var headerTreeElement = new UI.TreeElement(this._formatHeader(headers[i].name, headers[i].value)); headerTreeElement.selectable = false; headersTreeElement.appendChild(headerTreeElement); } @@ -432,7 +432,7 @@ * @param {string} title * @param {number} count * @param {string} headersText - * @param {!TreeElement} headersTreeElement + * @param {!UI.TreeElement} headersTreeElement */ _refreshHeadersText(title, count, headersText, headersTreeElement) { this._populateTreeElementWithSourceText(headersTreeElement, headersText); @@ -488,9 +488,9 @@ /** * @unrestricted */ -Network.RequestHeadersView.Category = class extends TreeElement { +Network.RequestHeadersView.Category = class extends UI.TreeElement { /** - * @param {!TreeOutline} root + * @param {!UI.TreeOutline} root * @param {string} name * @param {string=} title */ @@ -505,10 +505,10 @@ } /** - * @return {!TreeElement} + * @return {!UI.TreeElement} */ createLeaf() { - var leaf = new TreeElement(); + var leaf = new UI.TreeElement(); leaf.selectable = false; this.appendChild(leaf); return leaf;
diff --git a/third_party/WebKit/Source/devtools/front_end/network/XMLView.js b/third_party/WebKit/Source/devtools/front_end/network/XMLView.js index 53047bc4..fdbcdd7 100644 --- a/third_party/WebKit/Source/devtools/front_end/network/XMLView.js +++ b/third_party/WebKit/Source/devtools/front_end/network/XMLView.js
@@ -13,7 +13,7 @@ super(true); this.registerRequiredCSS('network/xmlView.css'); this.contentElement.classList.add('shadow-xml-view', 'source-code'); - this._treeOutline = new TreeOutlineInShadow(); + this._treeOutline = new UI.TreeOutlineInShadow(); this._treeOutline.registerRequiredCSS('network/xmlTree.css'); this.contentElement.appendChild(this._treeOutline.element); @@ -21,7 +21,7 @@ this._searchableView; /** @type {number} */ this._currentSearchFocusIndex = 0; - /** @type {!Array.<!TreeElement>} */ + /** @type {!Array.<!UI.TreeElement>} */ this._currentSearchTreeElements = []; /** @type {?UI.SearchableView.SearchConfig} */ this._searchConfig; @@ -213,7 +213,7 @@ /** * @unrestricted */ -Network.XMLView.Node = class extends TreeElement { +Network.XMLView.Node = class extends UI.TreeElement { /** * @param {!Node} node * @param {boolean} closeTag @@ -231,7 +231,7 @@ } /** - * @param {!TreeOutline|!TreeElement} root + * @param {!UI.TreeOutline|!UI.TreeElement} root * @param {!Node} xmlNode * @param {!Network.XMLView} xmlView */
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileLauncherView.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileLauncherView.js index b6421d13..cfd28b0 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileLauncherView.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileLauncherView.js
@@ -50,10 +50,10 @@ selectTargetText.textContent = Common.UIString('Target:'); var targetsSelect = targetSpan.createChild('select', 'chrome-select'); new Profiler.TargetsComboBoxController(targetsSelect, targetSpan); - this._controlButton = createTextButton('', this._controlButtonClicked.bind(this), 'control-profiling'); + this._controlButton = UI.createTextButton('', this._controlButtonClicked.bind(this), 'control-profiling'); this._contentElement.appendChild(this._controlButton); this._recordButtonEnabled = true; - this._loadButton = createTextButton(Common.UIString('Load'), this._loadButtonClicked.bind(this), 'load-profile'); + this._loadButton = UI.createTextButton(Common.UIString('Load'), this._loadButtonClicked.bind(this), 'load-profile'); this._contentElement.appendChild(this._loadButton); SDK.targetManager.observeTargets(this); } @@ -173,7 +173,7 @@ * @param {!Profiler.ProfileType} profileType */ addProfileType(profileType) { - var labelElement = createRadioLabel('profile-type', profileType.name); + var labelElement = UI.createRadioLabel('profile-type', profileType.name); this._profileTypeSelectorForm.appendChild(labelElement); var optionElement = labelElement.radioElement; this._typeIdToOptionElement[profileType.id] = optionElement;
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js index 1a61d12..1ff6273c 100644 --- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
@@ -401,7 +401,7 @@ this.profilesItemTreeElement = new Profiler.ProfilesSidebarTreeElement(this); - this._sidebarTree = new TreeOutlineInShadow(); + this._sidebarTree = new UI.TreeOutlineInShadow(); this._sidebarTree.registerRequiredCSS('profiler/profilesSidebarTree.css'); this.panelSidebarElement().appendChild(this._sidebarTree.element); @@ -870,7 +870,7 @@ /** * @unrestricted */ -Profiler.ProfileTypeSidebarSection = class extends TreeElement { +Profiler.ProfileTypeSidebarSection = class extends UI.TreeElement { /** * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate * @param {!Profiler.ProfileType} profileType @@ -908,7 +908,7 @@ var groupSize = group.profileSidebarTreeElements.length; if (groupSize === 2) { - // Make a group TreeElement now that there are 2 profiles. + // Make a group UI.TreeElement now that there are 2 profiles. group.sidebarTreeElement = new Profiler.ProfileGroupSidebarTreeElement(this._dataDisplayDelegate, profile.title); @@ -1039,7 +1039,7 @@ /** * @unrestricted */ -Profiler.ProfileSidebarTreeElement = class extends TreeElement { +Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement { /** * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate * @param {!Profiler.ProfileHeader} profile @@ -1163,7 +1163,7 @@ /** * @unrestricted */ -Profiler.ProfileGroupSidebarTreeElement = class extends TreeElement { +Profiler.ProfileGroupSidebarTreeElement = class extends UI.TreeElement { /** * @param {!Profiler.ProfileType.DataDisplayDelegate} dataDisplayDelegate * @param {string} title @@ -1201,7 +1201,7 @@ } }; -Profiler.ProfilesSidebarTreeElement = class extends TreeElement { +Profiler.ProfilesSidebarTreeElement = class extends UI.TreeElement { /** * @param {!Profiler.ProfilesPanel} panel */
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js b/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js index c99bed20c..4e0749e 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js
@@ -86,7 +86,7 @@ this._errorsSection.element.classList.toggle('hidden', !errors.length); for (var error of errors) { this._errorsSection.appendRow().appendChild( - createLabel(error.message, error.critical ? 'smallicon-error' : 'smallicon-warning')); + UI.createLabel(error.message, error.critical ? 'smallicon-error' : 'smallicon-warning')); } if (!data)
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js b/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js index 6e2f3bb..c674334 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/ClearStorageView.js
@@ -42,7 +42,7 @@ SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser); var footer = this._reportView.appendSection('', 'clear-storage-button').appendRow(); - this._clearButton = createTextButton( + this._clearButton = UI.createTextButton( Common.UIString('Clear site data'), this._clear.bind(this), Common.UIString('Clear site data')); footer.appendChild(this._clearButton); }
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js b/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js index 4b2220fc..de40430 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/ResourcesPanel.js
@@ -38,7 +38,7 @@ this._resourcesLastSelectedItemSetting = Common.settings.createSetting('resourcesLastSelectedItem', {}); - this._sidebarTree = new TreeOutlineInShadow(); + this._sidebarTree = new UI.TreeOutlineInShadow(); this._sidebarTree.element.classList.add('resources-sidebar'); this._sidebarTree.registerRequiredCSS('resources/resourcesSidebar.css'); this._sidebarTree.element.classList.add('filter-all'); @@ -113,10 +113,10 @@ /** * @param {string} title - * @return {!TreeElement} + * @return {!UI.TreeElement} */ _addSidebarSection(title) { - var treeElement = new TreeElement(title, true); + var treeElement = new UI.TreeElement(title, true); treeElement.listItemElement.classList.add('storage-group-list-item'); treeElement.setCollapsible(false); treeElement.selectable = false; @@ -828,7 +828,7 @@ /** * @unrestricted */ -Resources.BaseStorageTreeElement = class extends TreeElement { +Resources.BaseStorageTreeElement = class extends UI.TreeElement { /** * @param {!Resources.ResourcesPanel} storagePanel * @param {string} title
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js index f7d11a5..3e7d8520 100644 --- a/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js +++ b/third_party/WebKit/Source/devtools/front_end/resources/ServiceWorkersView.js
@@ -313,7 +313,7 @@ this._section.setFieldVisible(Common.UIString('Errors'), !!this._registration.errors.length); var errorsValue = this._wrapWidget(this._section.appendField(Common.UIString('Errors'))); - var errorsLabel = createLabel(String(this._registration.errors.length), 'smallicon-error'); + var errorsLabel = UI.createLabel(String(this._registration.errors.length), 'smallicon-error'); errorsLabel.classList.add('service-worker-errors-label'); errorsValue.appendChild(errorsLabel); this._moreButton = createLink( @@ -346,7 +346,7 @@ if (this._errorsList.childElementCount > 100) this._errorsList.firstElementChild.remove(); message.appendChild(this._linkifier.linkifyScriptLocation(target, null, error.sourceURL, error.lineNumber)); - message.appendChild(createLabel('#' + error.versionId + ': ' + error.errorMessage, 'smallicon-error')); + message.appendChild(UI.createLabel('#' + error.versionId + ': ' + error.errorMessage, 'smallicon-error')); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js index aff4b2c..24dbe1dc 100644 --- a/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js +++ b/third_party/WebKit/Source/devtools/front_end/sdk/SourceMap.js
@@ -31,12 +31,12 @@ /** * @unrestricted */ -var SourceMapV3 = class { +SDK.SourceMapV3 = class { constructor() { /** @type {number} */ this.version; /** @type {string|undefined} */ this.file; /** @type {!Array.<string>} */ this.sources; - /** @type {!Array.<!SourceMapV3.Section>|undefined} */ this.sections; + /** @type {!Array.<!SDK.SourceMapV3.Section>|undefined} */ this.sections; /** @type {string} */ this.mappings; /** @type {string|undefined} */ this.sourceRoot; /** @type {!Array.<string>|undefined} */ this.names; @@ -46,17 +46,17 @@ /** * @unrestricted */ -SourceMapV3.Section = class { +SDK.SourceMapV3.Section = class { constructor() { - /** @type {!SourceMapV3} */ this.map; - /** @type {!SourceMapV3.Offset} */ this.offset; + /** @type {!SDK.SourceMapV3} */ this.map; + /** @type {!SDK.SourceMapV3.Offset} */ this.offset; } }; /** * @unrestricted */ -SourceMapV3.Offset = class { +SDK.SourceMapV3.Offset = class { constructor() { /** @type {number} */ this.line; /** @type {number} */ this.column; @@ -179,7 +179,7 @@ * for format description. * @param {string} compiledURL * @param {string} sourceMappingURL - * @param {!SourceMapV3} payload + * @param {!SDK.SourceMapV3} payload */ constructor(compiledURL, sourceMappingURL, payload) { if (!SDK.TextSourceMap._base64Map) { @@ -225,7 +225,7 @@ if (content.slice(0, 3) === ')]}') content = content.substring(content.indexOf('\n')); try { - var payload = /** @type {!SourceMapV3} */ (JSON.parse(content)); + var payload = /** @type {!SDK.SourceMapV3} */ (JSON.parse(content)); var baseURL = sourceMapURL.startsWith('data:') ? compiledURL : sourceMapURL; callback(new SDK.TextSourceMap(compiledURL, baseURL, payload)); } catch (e) { @@ -399,7 +399,7 @@ } /** - * @param {function(!SourceMapV3, number, number)} callback + * @param {function(!SDK.SourceMapV3, number, number)} callback */ _eachSection(callback) { if (!this._json.sections) { @@ -411,7 +411,7 @@ } /** - * @param {!SourceMapV3} sourceMap + * @param {!SDK.SourceMapV3} sourceMap */ _parseSources(sourceMap) { var sourcesList = []; @@ -431,7 +431,7 @@ } /** - * @param {!SourceMapV3} map + * @param {!SDK.SourceMapV3} map * @param {number} lineNumber * @param {number} columnNumber */
diff --git a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js index ae1b3ed..a7e7edfee 100644 --- a/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js +++ b/third_party/WebKit/Source/devtools/front_end/security/SecurityPanel.js
@@ -52,7 +52,7 @@ panel.showCertificateViewer(); } - return createTextButton(text, showCertificateViewer, 'security-certificate-button'); + return UI.createTextButton(text, showCertificateViewer, 'security-certificate-button'); } /** @@ -73,7 +73,7 @@ SDK.multitargetNetworkManager.getCertificate(origin, certificateCallback); } - return createTextButton(text, showCertificateViewer, 'security-certificate-button'); + return UI.createTextButton(text, showCertificateViewer, 'security-certificate-button'); } /** @@ -383,7 +383,7 @@ /** * @unrestricted */ -Security.SecurityPanelSidebarTree = class extends TreeOutlineInShadow { +Security.SecurityPanelSidebarTree = class extends UI.TreeOutlineInShadow { /** * @param {!Security.SecurityPanelSidebarTreeElement} mainViewElement * @param {function(!Security.SecurityPanel.Origin)} showOriginInPanel @@ -397,12 +397,12 @@ this._showOriginInPanel = showOriginInPanel; this._mainOrigin = null; - /** @type {!Map<!Security.SecurityPanelSidebarTree.OriginGroupName, !TreeElement>} */ + /** @type {!Map<!Security.SecurityPanelSidebarTree.OriginGroupName, !UI.TreeElement>} */ this._originGroups = new Map(); for (var key in Security.SecurityPanelSidebarTree.OriginGroupName) { var originGroupName = Security.SecurityPanelSidebarTree.OriginGroupName[key]; - var originGroup = new TreeElement(originGroupName, true); + var originGroup = new UI.TreeElement(originGroupName, true); originGroup.selectable = false; originGroup.expand(); originGroup.listItemElement.classList.add('security-sidebar-origins'); @@ -412,7 +412,7 @@ this._clearOriginGroups(); // This message will be removed by clearOrigins() during the first new page load after the panel was opened. - var mainViewReloadMessage = new TreeElement(Common.UIString('Reload to view details')); + var mainViewReloadMessage = new UI.TreeElement(Common.UIString('Reload to view details')); mainViewReloadMessage.selectable = false; mainViewReloadMessage.listItemElement.classList.add('security-main-view-reload-message'); this._originGroups.get(Security.SecurityPanelSidebarTree.OriginGroupName.MainOrigin) @@ -520,7 +520,7 @@ /** * @unrestricted */ -Security.SecurityPanelSidebarTreeElement = class extends TreeElement { +Security.SecurityPanelSidebarTreeElement = class extends UI.TreeElement { /** * @param {string} text * @param {function()} selectCallback
diff --git a/third_party/WebKit/Source/devtools/front_end/settings/EditFileSystemView.js b/third_party/WebKit/Source/devtools/front_end/settings/EditFileSystemView.js index 9d4d9bd..5314a9e 100644 --- a/third_party/WebKit/Source/devtools/front_end/settings/EditFileSystemView.js +++ b/third_party/WebKit/Source/devtools/front_end/settings/EditFileSystemView.js
@@ -68,7 +68,7 @@ } else { mappingsPlaceholder.textContent = Common.UIString('No mappings'); mappingsHeader.appendChild( - createTextButton(Common.UIString('Add'), this._addMappingButtonClicked.bind(this), 'add-button')); + UI.createTextButton(Common.UIString('Add'), this._addMappingButtonClicked.bind(this), 'add-button')); } this._mappingsList.setEmptyPlaceholder(mappingsPlaceholder); this._mappingsList.show(this.contentElement); @@ -77,7 +77,7 @@ excludedFoldersHeader.createChild('div', 'file-system-header-text').textContent = Common.UIString('Excluded folders'); excludedFoldersHeader.appendChild( - createTextButton(Common.UIString('Add'), this._addExcludedFolderButtonClicked.bind(this), 'add-button')); + UI.createTextButton(Common.UIString('Add'), this._addExcludedFolderButtonClicked.bind(this), 'add-button')); this._excludedFoldersList = new UI.ListWidget(this); this._excludedFoldersList.element.classList.add('file-system-list'); this._excludedFoldersList.registerRequiredCSS('settings/editFileSystemView.css');
diff --git a/third_party/WebKit/Source/devtools/front_end/settings/FrameworkBlackboxSettingsTab.js b/third_party/WebKit/Source/devtools/front_end/settings/FrameworkBlackboxSettingsTab.js index 8e3858a..16de0f1 100644 --- a/third_party/WebKit/Source/devtools/front_end/settings/FrameworkBlackboxSettingsTab.js +++ b/third_party/WebKit/Source/devtools/front_end/settings/FrameworkBlackboxSettingsTab.js
@@ -29,7 +29,7 @@ this._list.setEmptyPlaceholder(placeholder); this._list.show(this.contentElement); var addPatternButton = - createTextButton(Common.UIString('Add pattern...'), this._addButtonClicked.bind(this), 'add-button'); + UI.createTextButton(Common.UIString('Add pattern...'), this._addButtonClicked.bind(this), 'add-button'); this.contentElement.appendChild(addPatternButton); this._setting = Common.moduleSetting('skipStackFramesPattern');
diff --git a/third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js b/third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js index 37d4a3b..ca1dcaf 100644 --- a/third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js +++ b/third_party/WebKit/Source/devtools/front_end/settings/SettingsScreen.js
@@ -177,7 +177,7 @@ self.runtime.extensions(UI.SettingUI).forEach(this._addSettingUI.bind(this)); this._appendSection().appendChild( - createTextButton(Common.UIString('Restore defaults and reload'), restoreAndReload)); + UI.createTextButton(Common.UIString('Restore defaults and reload'), restoreAndReload)); function restoreAndReload() { Common.settings.clearAll(); @@ -290,7 +290,7 @@ this._fileSystemsListContainer = this.containerElement.createChild('div', ''); this.containerElement.appendChild( - createTextButton(Common.UIString('Add folder\u2026'), this._addFileSystemClicked.bind(this))); + UI.createTextButton(Common.UIString('Add folder\u2026'), this._addFileSystemClicked.bind(this))); /** @type {!Map<string, !Element>} */ this._elementByPath = new Map(); @@ -438,7 +438,7 @@ } _createExperimentCheckbox(experiment) { - var label = createCheckboxLabel(Common.UIString(experiment.title), experiment.isEnabled()); + var label = UI.createCheckboxLabel(Common.UIString(experiment.title), experiment.isEnabled()); var input = label.checkboxElement; input.name = experiment.name; function listener() {
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/AdvancedSearchView.js b/third_party/WebKit/Source/devtools/front_end/sources/AdvancedSearchView.js index 38adfd2..1bc8b2fc 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/AdvancedSearchView.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/AdvancedSearchView.js
@@ -34,13 +34,13 @@ this._searchInputClearElement.hidden = true; this._searchInputClearElement.addEventListener('click', this._onSearchInputClear.bind(this), false); - this._ignoreCaseLabel = createCheckboxLabel(Common.UIString('Ignore case')); + this._ignoreCaseLabel = UI.createCheckboxLabel(Common.UIString('Ignore case')); this._ignoreCaseLabel.classList.add('search-config-label'); this._searchPanelElement.appendChild(this._ignoreCaseLabel); this._ignoreCaseCheckbox = this._ignoreCaseLabel.checkboxElement; this._ignoreCaseCheckbox.classList.add('search-config-checkbox'); - this._regexLabel = createCheckboxLabel(Common.UIString('Regular expression')); + this._regexLabel = UI.createCheckboxLabel(Common.UIString('Regular expression')); this._regexLabel.classList.add('search-config-label'); this._searchPanelElement.appendChild(this._regexLabel); this._regexCheckbox = this._regexLabel.checkboxElement;
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/EventListenerBreakpointsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/EventListenerBreakpointsSidebarPane.js index dab179f..75f7496e 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/EventListenerBreakpointsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/EventListenerBreakpointsSidebarPane.js
@@ -12,7 +12,7 @@ this._eventListenerBreakpointsSetting = Common.settings.createLocalSetting('eventListenerBreakpoints', []); - this._categoriesTreeOutline = new TreeOutlineInShadow(); + this._categoriesTreeOutline = new UI.TreeOutlineInShadow(); this._categoriesTreeOutline.element.tabIndex = 0; this._categoriesTreeOutline.element.classList.add('event-listener-breakpoints'); this._categoriesTreeOutline.registerRequiredCSS('sources/eventListenerBreakpoints.css'); @@ -130,10 +130,10 @@ * @param {!Array.<string>=} targetNames */ _createCategory(name, eventNames, isInstrumentationEvent, targetNames) { - var labelNode = createCheckboxLabel(name); + var labelNode = UI.createCheckboxLabel(name); var categoryItem = {}; - categoryItem.element = new TreeElement(labelNode); + categoryItem.element = new UI.TreeElement(labelNode); this._categoriesTreeOutline.appendChild(categoryItem.element); categoryItem.element.selectable = false; @@ -152,10 +152,10 @@ var breakpointItem = {}; var title = Sources.EventListenerBreakpointsSidebarPane.eventNameForUI(eventName); - labelNode = createCheckboxLabel(title); + labelNode = UI.createCheckboxLabel(title); labelNode.classList.add('source-code'); - breakpointItem.element = new TreeElement(labelNode); + breakpointItem.element = new UI.TreeElement(labelNode); categoryItem.element.appendChild(breakpointItem.element); breakpointItem.element.listItemElement.createChild('div', 'breakpoint-hit-marker');
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/FileBasedSearchResultsPane.js b/third_party/WebKit/Source/devtools/front_end/sources/FileBasedSearchResultsPane.js index 08416e65..e0bf4d8 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/FileBasedSearchResultsPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/FileBasedSearchResultsPane.js
@@ -12,7 +12,7 @@ super(searchConfig); this._searchResults = []; - this._treeOutline = new TreeOutlineInShadow(); + this._treeOutline = new UI.TreeOutlineInShadow(); this._treeOutline.registerRequiredCSS('sources/fileBasedSearchResultsPane.css'); this.element.appendChild(this._treeOutline.element); @@ -50,7 +50,7 @@ /** * @unrestricted */ -Sources.FileBasedSearchResultsPane.FileTreeElement = class extends TreeElement { +Sources.FileBasedSearchResultsPane.FileTreeElement = class extends UI.TreeElement { /** * @param {!Workspace.ProjectSearchConfig} searchConfig * @param {!Sources.FileBasedSearchResult} searchResult @@ -148,7 +148,7 @@ var contentSpan = this._createContentSpan(lineContent, matchRanges); anchor.appendChild(contentSpan); - var searchMatchElement = new TreeElement(); + var searchMatchElement = new UI.TreeElement(); searchMatchElement.selectable = false; this.appendChild(searchMatchElement); searchMatchElement.listItemElement.className = 'search-match source-code'; @@ -162,7 +162,7 @@ _appendShowMoreMatchesElement(startMatchIndex) { var matchesLeftCount = this._searchResult.searchMatches.length - startMatchIndex; var showMoreMatchesText = Common.UIString('Show all matches (%d more).', matchesLeftCount); - this._showMoreMatchesTreeElement = new TreeElement(showMoreMatchesText); + this._showMoreMatchesTreeElement = new UI.TreeElement(showMoreMatchesText); this.appendChild(this._showMoreMatchesTreeElement); this._showMoreMatchesTreeElement.listItemElement.classList.add('show-more-matches'); this._showMoreMatchesTreeElement.onselect = this._showMoreMatchesElementSelected.bind(this, startMatchIndex);
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptBreakpointsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptBreakpointsSidebarPane.js index 3ac3e1fa..1ec97df 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptBreakpointsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptBreakpointsSidebarPane.js
@@ -66,7 +66,7 @@ entry = this._listElement.createChild('div', 'breakpoint-entry'); entry.addEventListener('contextmenu', this._breakpointContextMenu.bind(this), true); entry.addEventListener('click', this._revealLocation.bind(this), false); - var checkboxLabel = createCheckboxLabel(''); + var checkboxLabel = UI.createCheckboxLabel(''); checkboxLabel.addEventListener('click', this._breakpointCheckboxClicked.bind(this), false); entry.appendChild(checkboxLabel); entry[Sources.JavaScriptBreakpointsSidebarPane._checkboxLabelSymbol] = checkboxLabel;
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js index da9800b0..e9f0577 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
@@ -34,7 +34,7 @@ super(); this.registerRequiredCSS('sources/navigatorView.css'); - this._scriptsTree = new TreeOutlineInShadow(); + this._scriptsTree = new UI.TreeOutlineInShadow(); this._scriptsTree.registerRequiredCSS('sources/navigatorTree.css'); this._scriptsTree.setComparator(Sources.NavigatorView._treeElementsCompare); this.element.appendChild(this._scriptsTree.element); @@ -81,7 +81,7 @@ } /** - * @param {!TreeElement} treeElement + * @param {!UI.TreeElement} treeElement */ static _treeElementOrder(treeElement) { if (treeElement._boostOrder) @@ -148,8 +148,8 @@ } /** - * @param {!TreeElement} treeElement1 - * @param {!TreeElement} treeElement2 + * @param {!UI.TreeElement} treeElement1 + * @param {!UI.TreeElement} treeElement2 * @return {number} */ static _treeElementsCompare(treeElement1, treeElement2) { @@ -835,7 +835,7 @@ /** * @unrestricted */ -Sources.NavigatorFolderTreeElement = class extends TreeElement { +Sources.NavigatorFolderTreeElement = class extends UI.TreeElement { /** * @param {!Sources.NavigatorView} navigatorView * @param {string} type @@ -926,7 +926,7 @@ /** * @unrestricted */ -Sources.NavigatorSourceTreeElement = class extends TreeElement { +Sources.NavigatorSourceTreeElement = class extends UI.TreeElement { /** * @param {!Sources.NavigatorView} navigatorView * @param {!Workspace.UISourceCode} uiSourceCode @@ -1085,7 +1085,7 @@ } /** - * @return {!TreeElement} + * @return {!UI.TreeElement} */ treeNode() { throw 'Not implemented'; @@ -1130,7 +1130,7 @@ wasPopulated() { var children = this.children(); for (var i = 0; i < children.length; ++i) - this.treeNode().appendChild(/** @type {!TreeElement} */ (children[i].treeNode())); + this.treeNode().appendChild(/** @type {!UI.TreeElement} */ (children[i].treeNode())); } /** @@ -1138,7 +1138,7 @@ */ didAddChild(node) { if (this.isPopulated()) - this.treeNode().appendChild(/** @type {!TreeElement} */ (node.treeNode())); + this.treeNode().appendChild(/** @type {!UI.TreeElement} */ (node.treeNode())); } /** @@ -1146,7 +1146,7 @@ */ willRemoveChild(node) { if (this.isPopulated()) - this.treeNode().removeChild(/** @type {!TreeElement} */ (node.treeNode())); + this.treeNode().removeChild(/** @type {!UI.TreeElement} */ (node.treeNode())); } /** @@ -1224,7 +1224,7 @@ /** * @override - * @return {!TreeElement} + * @return {!UI.TreeElement} */ treeNode() { return this._navigatorView._scriptsTree.rootElement(); @@ -1256,7 +1256,7 @@ /** * @override - * @return {!TreeElement} + * @return {!UI.TreeElement} */ treeNode() { if (this._treeElement) @@ -1401,7 +1401,7 @@ /** * @override - * @return {!TreeElement} + * @return {!UI.TreeElement} */ treeNode() { if (this._treeElement) @@ -1423,7 +1423,7 @@ } /** - * @return {!TreeElement} + * @return {!UI.TreeElement} */ _createTreeElement(title, node) { if (this._project.type() !== Workspace.projectTypes.FileSystem) { @@ -1570,7 +1570,7 @@ /** * @override - * @return {!TreeElement} + * @return {!UI.TreeElement} */ treeNode() { if (this._treeElement)
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/RevisionHistoryView.js b/third_party/WebKit/Source/devtools/front_end/sources/RevisionHistoryView.js index f3fb4975..8c84350 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/RevisionHistoryView.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/RevisionHistoryView.js
@@ -36,7 +36,7 @@ super(); this._uiSourceCodeItems = new Map(); - this._treeOutline = new TreeOutlineInShadow(); + this._treeOutline = new UI.TreeOutlineInShadow(); this._treeOutline.registerRequiredCSS('sources/revisionHistory.css'); this._treeOutline.makeDense(); this.element.appendChild(this._treeOutline.element); @@ -72,7 +72,7 @@ * @param {!Workspace.UISourceCode} uiSourceCode */ _createUISourceCodeItem(uiSourceCode) { - var uiSourceCodeItem = new TreeElement(uiSourceCode.displayName(), true); + var uiSourceCodeItem = new UI.TreeElement(uiSourceCode.displayName(), true); uiSourceCodeItem.selectable = false; // Insert in sorted order @@ -96,7 +96,7 @@ uiSourceCodeItem.appendChild(historyItem); } - var linkItem = new TreeElement(); + var linkItem = new UI.TreeElement(); linkItem.selectable = false; uiSourceCodeItem.appendChild(linkItem); @@ -178,7 +178,7 @@ /** * @unrestricted */ -Sources.RevisionHistoryTreeElement = class extends TreeElement { +Sources.RevisionHistoryTreeElement = class extends UI.TreeElement { /** * @param {!Workspace.Revision} revision * @param {!Workspace.Revision} baseRevision @@ -274,7 +274,7 @@ * @param {string} changeType */ _createLine(baseLineNumber, newLineNumber, lineContent, changeType) { - var child = new TreeElement(); + var child = new UI.TreeElement(); child.selectable = false; this.appendChild(child);
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js index d21e644..64526f5 100644 --- a/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js +++ b/third_party/WebKit/Source/devtools/front_end/sources/XHRBreakpointsSidebarPane.js
@@ -99,7 +99,7 @@ element.addEventListener('contextmenu', this._contextMenu.bind(this, url), true); var title = url ? Common.UIString('URL contains "%s"', url) : Common.UIString('Any XHR'); - var label = createCheckboxLabel(title, enabled); + var label = UI.createCheckboxLabel(title, enabled); element.appendChild(label); label.checkboxElement.addEventListener('click', this._checkboxClicked.bind(this, url), false); element._checkboxElement = label.checkboxElement;
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLandingPage.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLandingPage.js index 7bb3c02..af10637 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLandingPage.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLandingPage.js
@@ -11,8 +11,8 @@ this._tabbedPane = new UI.TabbedPane(); this._tabbedPane.setTabSlider(true); this._tabbedPane.renderWithNoHeaderBackground(); - this._currentTabSetting = Common.settings.createSetting( - 'performanceLandingPageTab', Timeline.TimelineLandingPage.PageId.Basic); + this._currentTabSetting = + Common.settings.createSetting('performanceLandingPageTab', Timeline.TimelineLandingPage.PageId.Basic); var tab = new Timeline.TimelineLandingPage.PerspectiveTabWidget(); tab.appendDescription(Common.UIString( @@ -120,8 +120,8 @@ this._forceEnable = new Map(); this._descriptionDiv = this.contentElement.createChild('div', 'timeline-perspective-description'); this._actionButtonDiv = this.contentElement.createChild('div'); - this._actionButtonDiv.appendChild(createTextButton(Common.UIString('Start profiling'), this._record)); - this._actionButtonDiv.appendChild(createTextButton(Common.UIString('Profile page load'), this._recordPageLoad)); + this._actionButtonDiv.appendChild(UI.createTextButton(Common.UIString('Start profiling'), this._record)); + this._actionButtonDiv.appendChild(UI.createTextButton(Common.UIString('Profile page load'), this._recordPageLoad)); } /**
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js index 8abad64..0bbceac 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js
@@ -1635,7 +1635,7 @@ this._progressLabel = progressLine.createChild('div', 'label'); this._progressBar = progressLine.createChild('div', 'indicator-container').createChild('div', 'indicator'); - this._stopButton = createTextButton(Common.UIString('Stop'), stopCallback); + this._stopButton = UI.createTextButton(Common.UIString('Stop'), stopCallback); this.contentElement.createChild('div', 'stop-button').appendChild(this._stopButton); }
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js index c1135885..28fb057 100644 --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineUIUtils.js
@@ -1193,7 +1193,7 @@ break; } - var invalidationsTreeOutline = new TreeOutlineInShadow(); + var invalidationsTreeOutline = new UI.TreeOutlineInShadow(); invalidationsTreeOutline.registerRequiredCSS('timeline/invalidationsTree.css'); invalidationsTreeOutline.element.classList.add('invalidations-tree'); @@ -1798,7 +1798,7 @@ /** * @unrestricted */ -Timeline.TimelineUIUtils.InvalidationsGroupElement = class extends TreeElement { +Timeline.TimelineUIUtils.InvalidationsGroupElement = class extends UI.TreeElement { /** * @param {!SDK.Target} target * @param {?Map<number, ?SDK.DOMNode>} relatedNodesMap @@ -1893,7 +1893,7 @@ } } - var contentTreeElement = new TreeElement(content, false); + var contentTreeElement = new UI.TreeElement(content, false); contentTreeElement.selectable = false; this.appendChild(contentTreeElement); }
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/CSSShadowEditor.js b/third_party/WebKit/Source/devtools/front_end/ui/CSSShadowEditor.js index 181ee66..7ea6cae 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/CSSShadowEditor.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/CSSShadowEditor.js
@@ -67,7 +67,7 @@ * @return {!Element} */ _createSlider(field) { - var slider = createSliderLabel(0, UI.CSSShadowEditor.maxRange, -1); + var slider = UI.createSliderLabel(0, UI.CSSShadowEditor.maxRange, -1); slider.addEventListener('input', this._onSliderInput.bind(this), false); field.appendChild(slider); return slider;
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js b/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js index fc1afbe..8feb0b04 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js
@@ -14,7 +14,7 @@ */ static create() { if (!UI.ColorSwatch._constructor) - UI.ColorSwatch._constructor = registerCustomElement('span', 'color-swatch', UI.ColorSwatch.prototype); + UI.ColorSwatch._constructor = UI.registerCustomElement('span', 'color-swatch', UI.ColorSwatch.prototype); return /** @type {!UI.ColorSwatch} */ (new UI.ColorSwatch._constructor()); } @@ -164,7 +164,7 @@ */ static create() { if (!UI.BezierSwatch._constructor) - UI.BezierSwatch._constructor = registerCustomElement('span', 'bezier-swatch', UI.BezierSwatch.prototype); + UI.BezierSwatch._constructor = UI.registerCustomElement('span', 'bezier-swatch', UI.BezierSwatch.prototype); return /** @type {!UI.BezierSwatch} */ (new UI.BezierSwatch._constructor()); } @@ -224,7 +224,7 @@ static create() { if (!UI.CSSShadowSwatch._constructor) { UI.CSSShadowSwatch._constructor = - registerCustomElement('span', 'css-shadow-swatch', UI.CSSShadowSwatch.prototype); + UI.registerCustomElement('span', 'css-shadow-swatch', UI.CSSShadowSwatch.prototype); } return /** @type {!UI.CSSShadowSwatch} */ (new UI.CSSShadowSwatch._constructor());
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js b/third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js index f9f4664..08a22e26 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/FilterBar.js
@@ -193,7 +193,7 @@ if (this._supportRegex) { this._filterElement.classList.add('supports-regex'); - var label = createCheckboxLabel(Common.UIString('Regex')); + var label = UI.createCheckboxLabel(Common.UIString('Regex')); this._regexCheckBox = label.checkboxElement; this._regexCheckBox.id = 'text-filter-regex'; this._regexCheckBox.addEventListener('change', this._valueChanged.bind(this), false); @@ -535,7 +535,7 @@ super(); this._filterElement = createElementWithClass('div', 'filter-checkbox-filter'); this._activeWhenChecked = !!activeWhenChecked; - this._label = createCheckboxLabel(title); + this._label = UI.createCheckboxLabel(title); this._filterElement.appendChild(this._label); this._checkboxElement = this._label.checkboxElement; if (setting)
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/HistoryInput.js b/third_party/WebKit/Source/devtools/front_end/ui/HistoryInput.js index 88a4495..2abd56e 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/HistoryInput.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/HistoryInput.js
@@ -14,7 +14,7 @@ */ static create() { if (!UI.HistoryInput._constructor) - UI.HistoryInput._constructor = registerCustomElement('input', 'history-input', UI.HistoryInput.prototype); + UI.HistoryInput._constructor = UI.registerCustomElement('input', 'history-input', UI.HistoryInput.prototype); return /** @type {!UI.HistoryInput} */ (new UI.HistoryInput._constructor()); }
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Icon.js b/third_party/WebKit/Source/devtools/front_end/ui/Icon.js index 9097968..6bcc79a 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/Icon.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/Icon.js
@@ -19,7 +19,7 @@ */ static create(iconType, className) { if (!UI.Icon._constructor) - UI.Icon._constructor = registerCustomElement('span', 'ui-icon', UI.Icon.prototype); + UI.Icon._constructor = UI.registerCustomElement('span', 'ui-icon', UI.Icon.prototype); var icon = /** @type {!UI.Icon} */ (new UI.Icon._constructor()); if (className)
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js b/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js index 7878a136..0832723 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/ListWidget.js
@@ -260,9 +260,9 @@ this._contentElement = this.element.createChild('div', 'editor-content'); var buttonsRow = this.element.createChild('div', 'editor-buttons'); - this._commitButton = createTextButton('', this._commitClicked.bind(this)); + this._commitButton = UI.createTextButton('', this._commitClicked.bind(this)); buttonsRow.appendChild(this._commitButton); - this._cancelButton = createTextButton(Common.UIString('Cancel'), this._cancelClicked.bind(this)); + this._cancelButton = UI.createTextButton(Common.UIString('Cancel'), this._cancelClicked.bind(this)); this._cancelButton.addEventListener( 'keydown', onKeyDown.bind(null, isEnterKey, this._cancelClicked.bind(this)), false); buttonsRow.appendChild(this._cancelButton);
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js b/third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js index 9edae2f..4922e23 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/SearchableView.js
@@ -133,7 +133,7 @@ // Column 4 this._replaceElement = this._firstRowElement.createChild('td').createChild('span'); - this._replaceLabelElement = createCheckboxLabel(Common.UIString('Replace')); + this._replaceLabelElement = UI.createCheckboxLabel(Common.UIString('Replace')); this._replaceCheckboxElement = this._replaceLabelElement.checkboxElement; this._uniqueId = ++UI.SearchableView._lastUniqueId; var replaceCheckboxId = 'search-replace-trigger' + this._uniqueId;
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js b/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js index 5f7ad1cd..a8aafa6 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/SettingsUI.js
@@ -37,7 +37,7 @@ * @return {!Element} */ UI.SettingsUI.createSettingCheckbox = function(name, setting, omitParagraphElement, tooltip) { - var label = createCheckboxLabel(name); + var label = UI.createCheckboxLabel(name); if (tooltip) label.title = tooltip;
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js index 11709408..df8ff288 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -898,7 +898,7 @@ * @param {function()=} listener */ constructor(text, title, setting, listener) { - super(createCheckboxLabel(text)); + super(UI.createCheckboxLabel(text)); this.element.classList.add('checkbox'); this.inputElement = this.element.checkboxElement; if (title)
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js index 0b6be95..18305b0 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -1230,9 +1230,9 @@ * @suppressGlobalPropertiesCheck * @template T */ -function registerCustomElement(localName, typeExtension, prototype) { +UI.registerCustomElement = function(localName, typeExtension, prototype) { return document.registerElement(typeExtension, {prototype: Object.create(prototype), extends: localName}); -} +}; /** * @param {string} text @@ -1241,7 +1241,7 @@ * @param {string=} title * @return {!Element} */ -function createTextButton(text, clickHandler, className, title) { +UI.createTextButton = function(text, clickHandler, className, title) { var element = createElementWithClass('button', className || '', 'text-button'); element.textContent = text; if (clickHandler) @@ -1249,7 +1249,7 @@ if (title) element.title = title; return element; -} +}; /** * @param {string} name @@ -1257,25 +1257,25 @@ * @param {boolean=} checked * @return {!Element} */ -function createRadioLabel(name, title, checked) { +UI.createRadioLabel = function(name, title, checked) { var element = createElement('label', 'dt-radio'); element.radioElement.name = name; element.radioElement.checked = !!checked; element.createTextChild(title); return element; -} +}; /** * @param {string} title * @param {string} iconClass * @return {!Element} */ -function createLabel(title, iconClass) { +UI.createLabel = function(title, iconClass) { var element = createElement('label', 'dt-icon-label'); element.createChild('span').textContent = title; element.type = iconClass; return element; -} +}; /** * @param {string=} title @@ -1283,7 +1283,7 @@ * @param {string=} subtitle * @return {!Element} */ -function createCheckboxLabel(title, checked, subtitle) { +UI.createCheckboxLabel = function(title, checked, subtitle) { var element = createElement('label', 'dt-checkbox'); element.checkboxElement.checked = !!checked; if (title !== undefined) { @@ -1295,7 +1295,7 @@ } } return element; -} +}; /** * @return {!Element} @@ -1303,14 +1303,14 @@ * @param {number} max * @param {number} tabIndex */ -function createSliderLabel(min, max, tabIndex) { +UI.createSliderLabel = function(min, max, tabIndex) { var element = createElement('label', 'dt-slider'); element.sliderElement.min = min; element.sliderElement.max = max; element.sliderElement.step = 1; element.sliderElement.tabIndex = tabIndex; return element; -} +}; /** * @param {!Node} node @@ -1336,7 +1336,7 @@ }; (function() { - registerCustomElement('button', 'text-button', { + UI.registerCustomElement('button', 'text-button', { /** * @this {Element} */ @@ -1349,7 +1349,7 @@ __proto__: HTMLButtonElement.prototype }); - registerCustomElement('label', 'dt-radio', { + UI.registerCustomElement('label', 'dt-radio', { /** * @this {Element} */ @@ -1377,7 +1377,7 @@ this.radioElement.dispatchEvent(new Event('change')); } - registerCustomElement('label', 'dt-checkbox', { + UI.registerCustomElement('label', 'dt-checkbox', { /** * @this {Element} */ @@ -1444,7 +1444,7 @@ __proto__: HTMLLabelElement.prototype }); - registerCustomElement('label', 'dt-icon-label', { + UI.registerCustomElement('label', 'dt-icon-label', { /** * @this {Element} */ @@ -1467,7 +1467,7 @@ __proto__: HTMLLabelElement.prototype }); - registerCustomElement('label', 'dt-slider', { + UI.registerCustomElement('label', 'dt-slider', { /** * @this {Element} */ @@ -1496,7 +1496,7 @@ __proto__: HTMLLabelElement.prototype }); - registerCustomElement('label', 'dt-small-bubble', { + UI.registerCustomElement('label', 'dt-small-bubble', { /** * @this {Element} */ @@ -1518,7 +1518,7 @@ __proto__: HTMLLabelElement.prototype }); - registerCustomElement('div', 'dt-close-button', { + UI.registerCustomElement('div', 'dt-close-button', { /** * @this {Element} */
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js b/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js index e65892c..99e46546 100644 --- a/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js +++ b/third_party/WebKit/Source/devtools/front_end/ui/treeoutline.js
@@ -29,7 +29,7 @@ /** * @unrestricted */ -var TreeOutline = class extends Common.Object { +UI.TreeOutline = class extends Common.Object { /** * @param {boolean=} nonFocusable */ @@ -39,7 +39,7 @@ this.selectedTreeElement = null; this.expandTreeElementsWhenArrowing = false; - /** @type {?function(!TreeElement, !TreeElement):number} */ + /** @type {?function(!UI.TreeElement, !UI.TreeElement):number} */ this._comparator = null; this.contentElement = this._rootElement._childrenListNode; @@ -53,7 +53,7 @@ /** * @param {boolean} isFocused - * @this {TreeOutline} + * @this {UI.TreeOutline} */ function setFocused(isFocused) { this._focused = isFocused; @@ -63,7 +63,7 @@ } _createRootElement() { - this._rootElement = new TreeElement(); + this._rootElement = new UI.TreeElement(); this._rootElement.treeOutline = this; this._rootElement.root = true; this._rootElement.selectable = false; @@ -72,28 +72,28 @@ } /** - * @return {!TreeElement} + * @return {!UI.TreeElement} */ rootElement() { return this._rootElement; } /** - * @return {?TreeElement} + * @return {?UI.TreeElement} */ firstChild() { return this._rootElement.firstChild(); } /** - * @param {!TreeElement} child + * @param {!UI.TreeElement} child */ appendChild(child) { this._rootElement.appendChild(child); } /** - * @param {!TreeElement} child + * @param {!UI.TreeElement} child * @param {number} index */ insertChild(child, index) { @@ -101,7 +101,7 @@ } /** - * @param {!TreeElement} child + * @param {!UI.TreeElement} child */ removeChild(child) { this._rootElement.removeChild(child); @@ -114,7 +114,7 @@ /** * @param {number} x * @param {number} y - * @return {?TreeElement} + * @return {?UI.TreeElement} */ treeElementFromPoint(x, y) { var node = this.contentElement.ownerDocument.deepElementFromPoint(x, y); @@ -129,14 +129,14 @@ /** * @param {?Event} event - * @return {?TreeElement} + * @return {?UI.TreeElement} */ treeElementFromEvent(event) { return event ? this.treeElementFromPoint(event.pageX, event.pageY) : null; } /** - * @param {?function(!TreeElement, !TreeElement):number} comparator + * @param {?function(!UI.TreeElement, !UI.TreeElement):number} comparator */ setComparator(comparator) { this._comparator = comparator; @@ -157,7 +157,7 @@ } /** - * @param {!TreeElement} element + * @param {!UI.TreeElement} element */ _bindTreeElement(element) { if (element.treeOutline) @@ -167,7 +167,7 @@ } /** - * @param {!TreeElement} element + * @param {!UI.TreeElement} element */ _unbindTreeElement(element) { if (!element.treeOutline) @@ -245,7 +245,7 @@ } /** - * @param {!TreeElement} treeElement + * @param {!UI.TreeElement} treeElement * @param {boolean} center */ _deferredScrollIntoView(treeElement, center) { @@ -254,7 +254,7 @@ this._treeElementToScrollIntoView = treeElement; this._centerUponScrollIntoView = center; /** - * @this {TreeOutline} + * @this {UI.TreeOutline} */ function deferredScrollIntoView() { this._treeElementToScrollIntoView.listItemElement.scrollIntoViewIfNeeded(this._centerUponScrollIntoView); @@ -265,7 +265,7 @@ }; /** @enum {symbol} */ -TreeOutline.Events = { +UI.TreeOutline.Events = { ElementAttached: Symbol('ElementAttached'), ElementExpanded: Symbol('ElementExpanded'), ElementCollapsed: Symbol('ElementCollapsed'), @@ -275,7 +275,7 @@ /** * @unrestricted */ -var TreeOutlineInShadow = class extends TreeOutline { +UI.TreeOutlineInShadow = class extends UI.TreeOutline { constructor() { super(); this.contentElement.classList.add('tree-outline'); @@ -307,13 +307,13 @@ /** * @unrestricted */ -var TreeElement = class { +UI.TreeElement = class { /** * @param {(string|!Node)=} title * @param {boolean=} expandable */ constructor(title, expandable) { - /** @type {?TreeOutline} */ + /** @type {?UI.TreeOutline} */ this.treeOutline = null; this.parent = null; this.previousSibling = null; @@ -341,7 +341,7 @@ } /** - * @param {?TreeElement} ancestor + * @param {?UI.TreeElement} ancestor * @return {boolean} */ hasAncestor(ancestor) { @@ -359,7 +359,7 @@ } /** - * @param {?TreeElement} ancestor + * @param {?UI.TreeElement} ancestor * @return {boolean} */ hasAncestorOrSelf(ancestor) { @@ -367,7 +367,7 @@ } /** - * @return {!Array.<!TreeElement>} + * @return {!Array.<!UI.TreeElement>} */ children() { return this._children || []; @@ -381,14 +381,14 @@ } /** - * @return {?TreeElement} + * @return {?UI.TreeElement} */ firstChild() { return this._children ? this._children[0] : null; } /** - * @return {?TreeElement} + * @return {?UI.TreeElement} */ lastChild() { return this._children ? this._children[this._children.length - 1] : null; @@ -396,14 +396,14 @@ /** * @param {number} index - * @return {?TreeElement} + * @return {?UI.TreeElement} */ childAt(index) { return this._children ? this._children[index] : null; } /** - * @param {!TreeElement} child + * @param {!UI.TreeElement} child * @return {number} */ indexOfChild(child) { @@ -411,7 +411,7 @@ } /** - * @param {!TreeElement} child + * @param {!UI.TreeElement} child */ appendChild(child) { if (!this._children) @@ -426,7 +426,7 @@ } /** - * @param {!TreeElement} child + * @param {!UI.TreeElement} child * @param {number} index */ insertChild(child, index) { @@ -468,7 +468,7 @@ child.onattach(); child._ensureSelection(); if (this.treeOutline) - this.treeOutline.dispatchEventToListeners(TreeOutline.Events.ElementAttached, child); + this.treeOutline.dispatchEventToListeners(UI.TreeOutline.Events.ElementAttached, child); var nextSibling = child.nextSibling ? child.nextSibling._listItemNode : null; this._childrenListNode.insertBefore(child._listItemNode, nextSibling); this._childrenListNode.insertBefore(child._childrenListNode, nextSibling); @@ -515,7 +515,7 @@ } /** - * @param {!TreeElement} child + * @param {!UI.TreeElement} child */ removeChild(child) { if (!child) @@ -833,7 +833,7 @@ this.expanded = false; this.oncollapse(); if (this.treeOutline) - this.treeOutline.dispatchEventToListeners(TreeOutline.Events.ElementCollapsed, this); + this.treeOutline.dispatchEventToListeners(UI.TreeOutline.Events.ElementCollapsed, this); } collapseRecursively() { @@ -861,7 +861,7 @@ if (this.treeOutline) { this.onexpand(); - this.treeOutline.dispatchEventToListeners(TreeOutline.Events.ElementExpanded, this); + this.treeOutline.dispatchEventToListeners(UI.TreeOutline.Events.ElementExpanded, this); } } @@ -1010,7 +1010,7 @@ this.treeOutline.selectedTreeElement = this; this._listItemNode.classList.add('selected'); this._setFocused(this.treeOutline._focused); - this.treeOutline.dispatchEventToListeners(TreeOutline.Events.ElementSelected, this); + this.treeOutline.dispatchEventToListeners(UI.TreeOutline.Events.ElementSelected, this); return this.onselect(selectedByUser); } @@ -1100,10 +1100,10 @@ /** * @param {boolean} skipUnrevealed - * @param {?TreeElement=} stayWithin + * @param {?UI.TreeElement=} stayWithin * @param {boolean=} dontPopulate * @param {!Object=} info - * @return {?TreeElement} + * @return {?UI.TreeElement} */ traverseNextTreeElement(skipUnrevealed, stayWithin, dontPopulate, info) { if (!dontPopulate) @@ -1144,7 +1144,7 @@ /** * @param {boolean} skipUnrevealed * @param {boolean=} dontPopulate - * @return {?TreeElement} + * @return {?UI.TreeElement} */ traversePreviousTreeElement(skipUnrevealed, dontPopulate) { var element = skipUnrevealed ? (this.revealed() ? this.previousSibling : null) : this.previousSibling; @@ -1178,9 +1178,9 @@ console.assert(paddingLeftValue.endsWith('px')); var computedLeftPadding = parseFloat(paddingLeftValue); var left = this._listItemNode.totalOffsetLeft() + computedLeftPadding; - return event.pageX >= left && event.pageX <= left + TreeElement._ArrowToggleWidth && this._expandable; + return event.pageX >= left && event.pageX <= left + UI.TreeElement._ArrowToggleWidth && this._expandable; } }; /** @const */ -TreeElement._ArrowToggleWidth = 10; +UI.TreeElement._ArrowToggleWidth = 10;
diff --git a/third_party/WebKit/Source/devtools/scripts/namespaces.js b/third_party/WebKit/Source/devtools/scripts/namespaces.js index a144a2f..e395f1c6 100644 --- a/third_party/WebKit/Source/devtools/scripts/namespaces.js +++ b/third_party/WebKit/Source/devtools/scripts/namespaces.js
@@ -23,10 +23,8 @@ String.prototype.replaceAll = function(a, b) { var result = this; - while (result.includes(a)) - result = result.replace(a, b); - return result; -} + return result.split(a).join(b); +}; function read(filePath) { @@ -38,24 +36,8 @@ var moduleName = oldModuleName; - // if (oldModuleName === "accessibility") - // moduleName = "a11y"; - // if (oldModuleName === "resources") - // moduleName = "storage"; - // if (oldModuleName === "console") - // moduleName = "consoleUI"; - - - // if (oldModuleName === "timeline") - // moduleName = "timelineUI"; - // if (oldModuleName === "timeline_model") - // moduleName = "timeline"; - - // moduleName = "com.google.chrome.devtools." + moduleName; - // moduleName = "dt";// + moduleName; if (moduleName === "sdk" || moduleName == "ui") moduleName = moduleName.toUpperCase(); - // moduleName = "dt" + moduleName.substring(0, 1).toUpperCase() + moduleName.substring(1); moduleName = moduleName.split("_").map(a => a.substring(0, 1).toUpperCase() + a.substring(1)).join(""); if (moduleName.includes("/")) return; @@ -63,22 +45,20 @@ var lines = content.split("\n"); for (var line of lines) { - var line = line.trim(); - if (!line.startsWith("WebInspector.")) + // Replace with your own logic + if (!line.startsWith("var ")) continue; - var match = line.match(/^(WebInspector.[a-z_A-Z0-9]+)\s*(\=[^,}]|[;])/) || line.match(/^(WebInspector.[a-z_A-Z0-9]+)\s*\=$/); + var globalVariableMatch = line.match(/^var ([a-z_A-Z0-9]+)\s*(\=)/); + var match = globalVariableMatch; + if (!match) continue; var name = match[1]; - if (name.split(".").length !== 2) - continue; var weight = line.endsWith(name + ";") ? 2 : 1; var newName; - var shortName = newName; - newName = name.replace("WebInspector.", moduleName + "."); - shortName = newName.replace(moduleName + ".", ""); + newName = moduleName + "." + name; var existing = map.get(name); if (existing && existing.weight > weight) continue; @@ -88,29 +68,29 @@ } } - function write(filePath) { var content = fs.readFileSync(filePath).toString(); var newContent = content; - for (var key of sortedKeys) - newContent = newContent.replaceAll(key, map.get(key).name); - newContent = newContent.replaceAll("UI._focusChanged.bind(WebInspector", "UI._focusChanged.bind(UI"); - newContent = newContent.replaceAll("UI._windowFocused.bind(WebInspector", "UI._windowFocused.bind(UI"); - newContent = newContent.replaceAll("UI._windowBlurred.bind(WebInspector", "UI._windowBlurred.bind(UI"); - newContent = newContent.replaceAll("UI._focusChanged.bind(WebInspector", "UI._focusChanged.bind(UI"); - newContent = newContent.replaceAll("UI._focusChanged.bind(WebInspector", "UI._focusChanged.bind(UI"); - newContent = newContent.replaceAll("Components.reload.bind(WebInspector", "Components.reload.bind(Components"); - newContent = newContent.replaceAll("window.opener.WebInspector['AdvancedApp']['_instance']()", "window.opener['Emulation']['AdvancedApp']['_instance']()"); - newContent = newContent.replaceAll("if (window['WebInspector'][", "if (window['WebInspector'] && window['WebInspector']["); + for (var key of sortedKeys) { + var originalIdentifier = key; + var newIdentifier = map.get(key).name; + newContent = newContent.split("\n").map(function (line) { + return processLine(line); + }).join("\n"); + } if (content !== newContent) fs.writeFileSync(filePath, newContent); } +function processLine(line) { + // Add transformation logic + return line; +} + function walkSync(currentDirPath, process, json) { - var fs = require('fs'), - path = require('path'); + var path = require('path'); fs.readdirSync(currentDirPath).forEach(function (name) { var filePath = path.join(currentDirPath, name); var stat = fs.statSync(filePath); @@ -118,7 +98,7 @@ if (filePath.includes("ExtensionAPI.js")) return; if (filePath.includes("externs.js")) - return; + return; if (filePath.includes("eslint") || filePath.includes("lighthouse-background.js") || filePath.includes("/cm/") || filePath.includes("/xterm.js/") || filePath.includes("/acorn/") || filePath.includes("/gonzales-scss")) return; if (filePath.includes("/cm_modes/") && !filePath.includes("DefaultCodeMirror") && !filePath.includes("module.json")) @@ -131,10 +111,13 @@ } walkSync('front_end', read); + sortedKeys = Array.from(map.keys()); -sortedKeys.sort((a, b) => (b.length - a.length) || a.localeCompare(b)); +sortedKeys.sort((a, b) => a.localeCompare(b)); + for (var key of sortedKeys) console.log(key + " => " + map.get(key).name); + walkSync('front_end', write, true); walkSync('../../LayoutTests/http/tests/inspector', write, false);
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h index 3b5eeb6b..db45c61 100644 --- a/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h +++ b/third_party/WebKit/Source/modules/encryptedmedia/MediaKeys.h
@@ -93,8 +93,6 @@ DECLARE_VIRTUAL_TRACE(); // ContextLifecycleObserver implementation. - // FIXME: This class could derive from ContextLifecycleObserver - // again (http://crbug.com/483722). void contextDestroyed() override; // ScriptWrappable implementation.
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp index 619f3c80..eec1bfc 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
@@ -92,7 +92,7 @@ FileSystemType type, const KURL& rootURL) : DOMFileSystemBase(context, name, type, rootURL), - ContextLifecycleObserver(context), + ContextClient(context), m_numberOfPendingCallbacks(0), m_rootEntry(DirectoryEntry::create(this, DOMFilePath::root)) {} @@ -191,7 +191,7 @@ DEFINE_TRACE(DOMFileSystem) { DOMFileSystemBase::trace(visitor); - ContextLifecycleObserver::trace(visitor); + ContextClient::trace(visitor); visitor->trace(m_rootEntry); }
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.h b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.h index dfa990e3..772709a 100644 --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.h +++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.h
@@ -55,7 +55,7 @@ : public DOMFileSystemBase, public ScriptWrappable, public ActiveScriptWrappable<DOMFileSystem>, - public ContextLifecycleObserver { + public ContextClient { DEFINE_WRAPPERTYPEINFO(); USING_GARBAGE_COLLECTED_MIXIN(DOMFileSystem);
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp index 7efb5056..3f9a81e8 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.cpp
@@ -97,7 +97,7 @@ const HashSet<String>& scope, WebIDBTransactionMode mode, IDBDatabase* db) - : ContextLifecycleObserver(scriptState->getExecutionContext()), + : ContextClient(scriptState->getExecutionContext()), m_id(id), m_database(db), m_mode(mode), @@ -121,7 +121,7 @@ IDBDatabase* db, IDBOpenDBRequest* openDBRequest, const IDBDatabaseMetadata& oldMetadata) - : ContextLifecycleObserver(executionContext), + : ContextClient(executionContext), m_id(id), m_database(db), m_openDBRequest(openDBRequest), @@ -149,7 +149,7 @@ visitor->trace(m_oldStoreMetadata); visitor->trace(m_deletedIndexes); EventTargetWithInlineData::trace(visitor); - ContextLifecycleObserver::trace(visitor); + ContextClient::trace(visitor); } void IDBTransaction::setError(DOMException* error) { @@ -452,7 +452,7 @@ } ExecutionContext* IDBTransaction::getExecutionContext() const { - return ContextLifecycleObserver::getExecutionContext(); + return ContextClient::getExecutionContext(); } DispatchEventResult IDBTransaction::dispatchEventInternal(Event* event) {
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h index 1c3a124..a012eff9 100644 --- a/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h +++ b/third_party/WebKit/Source/modules/indexeddb/IDBTransaction.h
@@ -56,7 +56,7 @@ class MODULES_EXPORT IDBTransaction final : public EventTargetWithInlineData, public ActiveScriptWrappable<IDBTransaction>, - public ContextLifecycleObserver { + public ContextClient { USING_GARBAGE_COLLECTED_MIXIN(IDBTransaction); DEFINE_WRAPPERTYPEINFO();
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp index c68701c..b846410e 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp +++ b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp
@@ -84,7 +84,7 @@ } ExecutionContext* PresentationRequest::getExecutionContext() const { - return ContextLifecycleObserver::getExecutionContext(); + return ContextClient::getExecutionContext(); } void PresentationRequest::addedEventListener( @@ -205,11 +205,11 @@ DEFINE_TRACE(PresentationRequest) { visitor->trace(m_availabilityProperty); EventTargetWithInlineData::trace(visitor); - ContextLifecycleObserver::trace(visitor); + ContextClient::trace(visitor); } PresentationRequest::PresentationRequest(ExecutionContext* executionContext, const KURL& url) - : ContextLifecycleObserver(executionContext), m_url(url) {} + : ContextClient(executionContext), m_url(url) {} } // namespace blink
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationRequest.h b/third_party/WebKit/Source/modules/presentation/PresentationRequest.h index 3b59a45..d914c10 100644 --- a/third_party/WebKit/Source/modules/presentation/PresentationRequest.h +++ b/third_party/WebKit/Source/modules/presentation/PresentationRequest.h
@@ -22,7 +22,7 @@ class MODULES_EXPORT PresentationRequest final : public EventTargetWithInlineData, public ActiveScriptWrappable<PresentationRequest>, - public ContextLifecycleObserver { + public ContextClient { USING_GARBAGE_COLLECTED_MIXIN(PresentationRequest); DEFINE_WRAPPERTYPEINFO();
diff --git a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp index 24bdf71..a8a1d766 100644 --- a/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp +++ b/third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp
@@ -13,6 +13,7 @@ #include "core/page/FocusController.h" #include "core/page/Page.h" #include "core/paint/PaintLayer.h" +#include "platform/graphics/paint/TransformPaintPropertyNode.h" #include "platform/testing/URLTestHelpers.h" #include "platform/testing/UnitTestHelpers.h" #include "public/platform/WebDisplayItemList.h" @@ -930,4 +931,50 @@ EXPECT_TRUE(result->IsTrue()); } +TEST_F(FrameThrottlingTest, UpdatePaintPropertiesOnUnthrottling) { + if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) + return; + + SimRequest mainResource("https://example.com/", "text/html"); + SimRequest frameResource("https://example.com/iframe.html", "text/html"); + + loadURL("https://example.com/"); + mainResource.complete("<iframe id=frame sandbox src=iframe.html></iframe>"); + frameResource.complete("<div id='div'>Inner</div>"); + compositeFrame(); + + auto* frameElement = toHTMLIFrameElement(document().getElementById("frame")); + auto* frameDocument = frameElement->contentDocument(); + auto* innerDiv = frameDocument->getElementById("div"); + auto* innerDivObject = innerDiv->layoutObject(); + EXPECT_FALSE(frameDocument->view()->shouldThrottleRendering()); + + frameElement->setAttribute(HTMLNames::styleAttr, + "transform: translateY(1000px)"); + compositeFrame(); + EXPECT_TRUE(frameDocument->view()->canThrottleRendering()); + EXPECT_FALSE(innerDivObject->paintProperties()->transform()); + + // Mutating the throttled frame should not cause paint property update. + innerDiv->setAttribute(HTMLNames::styleAttr, "transform: translateY(20px)"); + EXPECT_FALSE(compositor().needsBeginFrame()); + EXPECT_TRUE(frameDocument->view()->canThrottleRendering()); + { + DocumentLifecycle::AllowThrottlingScope throttlingScope( + document().lifecycle()); + document().view()->updateAllLifecyclePhases(); + } + EXPECT_FALSE(innerDivObject->paintProperties()->transform()); + + // Move the frame back on screen to unthrottle it. + frameElement->setAttribute(HTMLNames::styleAttr, ""); + // The first update unthrottles the frame, the second actually update layout + // and paint properties etc. + compositeFrame(); + compositeFrame(); + EXPECT_FALSE(frameDocument->view()->canThrottleRendering()); + EXPECT_EQ(TransformationMatrix().translate(0, 20), + innerDiv->layoutObject()->paintProperties()->transform()->matrix()); +} + } // namespace blink