Commit graph

74 commits

Author SHA1 Message Date
Josh Matthews
7d931e673a
script: Include constructors and static methods in generated DOM traits (#33665)
* Add all constructors, special operations, and static methods to generated DOM interface traits.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Move all constructors and static methods defined in bare impl blocks inside FooMethods trait impls.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

* Add missing doc links.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>

---------

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-10-08 01:51:58 +00:00
Simon Wülker
cc3c69b953
implement console.timeLog (#33377)
* Implement console.timeLog

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Adjust WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
2024-09-09 16:48:49 +00:00
Andriy Sultanov
aadc212b95
jsstring_to_str should accept a NonNull argument for the JS string (#33306)
Instead of asserting the raw pointer is not null, force callers to
produce a NonNull pointer.

Signed-off-by: Andriy Sultanov <sultanovandriy@gmail.com>
2024-09-05 03:25:49 +00:00
Josh Matthews
3829e91662
Handle failed string conversions in console.log. (#33085)
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
2024-08-16 16:49:56 +00:00
eri
2888193cfe
DevTools: Replace camel case variable names (#32726)
* refactor: rename to snake case

* refactor: more renaming

* chore: format

* chore: clean
2024-07-08 11:18:35 +00:00
Ekta Siwach
1bc63801e7
fix redundant closures in component/script/dom (#31917)
* fixed unnecessary conversions

* resolved conflicts

* resolved conflicts

* fix redundant closures in component/script/dom

* resolved conflicts

* fixed formatting
2024-03-28 09:06:02 +00:00
Rosemary Ajayi
072b892706
clippy:fix various clippy problems in components/scripts (#31907)
* manual implementation of an assign operation

* manual implementation of an assign operation

* single-character string

* manual cjheck for common ascii range
2024-03-27 22:14:41 +00:00
Aarya Khandelwal
d814d05539
fixed the unneeded return statement warnings. (#31863) 2024-03-26 08:58:34 +00:00
Smitty
d2dcb20bea
Implement console.count/countReset (#31635)
* Implement console.count/countReset

* Address review comment

Signed-off-by: syvb <me@iter.ca>

---------

Signed-off-by: syvb <me@iter.ca>
2024-03-17 09:50:40 +00:00
Smitty
036bca69ae
Fix crash on large console log (#31267) 2024-02-06 09:01:47 +00:00
Smitty
50c930866b
Make console methods take any instead of string (#31241)
* Make console methods use `any` for the message

Match the Console spec by allowing any value to be passed to console
methods, instead of just values that can be converted to a string.

Signed-off-by: syvb <me@iter.ca>

* Add test for console logging a Symbol

Signed-off-by: syvb <me@iter.ca>

* Implement object stringification for logs

Signed-off-by: syvb <me@iter.ca>

* Address review comments

Signed-off-by: syvb <me@iter.ca>

* Make time/timeEnd accept DOMString to match spec

* Update WPT results for layout 2013

---------

Signed-off-by: syvb <me@iter.ca>
2024-02-05 14:30:53 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Josh Matthews
9ea1399c30 Fix formatting. 2023-05-20 11:05:10 -04:00
Josh Matthews
f79e1e327d Make GlobalScope.get_cx a static method. 2023-05-20 11:05:09 -04:00
mustafapc19
d8b6755a8d Console.Clear implemented 2020-07-29 22:19:18 +05:30
Josh Matthews
2d7effddef Implement Console grouping APIs. 2020-07-06 19:36:26 -04:00
Josh Matthews
ab7ade4efe Report real caller information for console APIs to devtools. 2020-04-28 21:32:41 -04:00
Kunal Mohan
f7db4b7f80
Modify script to prevent further violations of snake_case 2020-01-18 14:22:15 +05:30
Jan Andre Ikenmeyer
a1a14459c1
Update MPL license to https (part 3) 2018-11-19 14:47:12 +01:00
Simon Sapin
76e59a46d3 Sort use statements 2018-11-06 15:26:02 +01:00
Simon Sapin
45f7199eee cargo fix --edition 2018-11-06 15:26:02 +01:00
chansuke
c37a345dc9 Format script component 2018-09-19 17:40:47 -04:00
Josh Matthews
b29d0c6c31 Hold stderr lock when using stdout through Console APIs. 2017-06-16 17:55:25 -04:00
Anthony Ramine
19108aa330 Pass a &GlobalScope to WebIDL static methods and constructors 2016-10-06 21:35:49 +02:00
Anthony Ramine
092504b4e3 Make Console::send_to_devtools take a &GlobalScope 2016-10-06 21:35:43 +02:00
Anthony Ramine
27f100b1d4 Introduce GlobalScope::pipeline_id 2016-10-06 20:59:13 +02:00
Anthony Ramine
fe6fca9e1f Introduce GlobalScope::devtools_chan 2016-10-06 20:59:11 +02:00
Anthony Ramine
14a0b8d88c Move console timers to GlobalScope 2016-10-06 20:59:11 +02:00
Anthony Ramine
e2dfcb658b Remove GlobalRef::get_worker_id 2016-10-04 13:58:26 +02:00
Arthur Marble
dbec9d8454 More code refactoring (exampleVar to example_var) 2016-09-18 01:02:57 -05:00
Aneesh Agrawal
9d097e7d15 Use fn pipeline_id consistently, not fn pipeline
Consistently use the name 'pipeline_id' to refer to a function that
returns an (optional) PipelineId.

This was prompted by discovering both fn pipeline and fn pipeline_id
doing the same job in htmliframeelement.rs.

Note that there is fn pipeline in components/compositing/compositor.rs,
but that actually returns an Option<&CompositionPipeline>, not any kind
of PipelineId.
2016-09-13 15:17:40 -04:00
Anthony Ramine
2bc0862f47 Make console a namespace (fixes #13010) 2016-09-10 14:33:08 +02:00
Anthony Ramine
7a942b1742 Store Console timers in globals 2016-09-07 15:48:22 +02:00
Anthony Ramine
cdc7bca944 Move DOMString back to script
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
Joshua Holmer
f0765890fe Implement console#time and console#timeEnd methods
Fixes #9325
2016-01-25 14:21:32 -05:00
Chad Kimes
ce6075825d Add global default method for Reflectable trait 2016-01-11 20:23:47 -05:00
Anthony Ramine
189d373cbe Introduce Console::send_to_devtools
This replaces propagate_console_msg and wraps prepare_message.
2016-01-09 17:31:32 +01:00
Anthony Ramine
0e3f066e8a Remove the global field from Console
We can just go through the reflector.
2016-01-09 16:02:41 +01:00
Ms2ger
0c61be7a57 Rustfmt some of script. 2015-11-18 11:14:05 +01:00
Alan Jeffrey
84bde75b42 Replaced DOMString constructor by conversion functions.
Replaced DOMString(...) by DOMString::from(...).
Replaced ....0 by String::from(...).
Removed any uses of .to_owner() in DOMString::from("...").
2015-11-12 17:52:59 -06:00
Ms2ger
6b75078503 Make DOMString a newtype around String, rather than a typedef.
This should make it somewhat easier to experiment with alternative
representations in the future. To reduce churn, this commit leaves the String
field public, though.

Also, this will allow us to use the default String type to represent the IDL
USVString type, which explicitly forbids unpaired surrogates, ans as such is
a better match to the Rust String type.
2015-11-04 12:09:11 +01:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Anthony Ramine
709d347872 Make the traits for the IDL interfaces take &self 2015-08-27 22:27:43 +02:00
Anthony Ramine
c831c2c0a5 Remove helper traits
Now that JSRef<T> is gone, there is no need to have helper traits.

On components/script/*.rs:

    # Remove imports.
    /^ *use dom::[a-z]+::\{.*Helpers/ {
        s/\{(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers, /\{/
        s/, (Raw[^L]|[^L][^a])[a-zA-Z]+Helpers([,}])/\2/g
        s/\{([a-zA-Z]+)\}/\1/
        /\{\}/d
        s/::self;$/;/
    }
    /^ *use dom::[a-z]+::\{?(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers\}?;$/d

On components/script/dom/*.rs:

    # Ignore layout things.
    /^(pub )?(impl|trait).*Layout.* \{/,/^}$/ { P; D; }

    # Delete helpers traits.
    /^(pub )?trait ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? \{$/,/^\}$/D

    # Patch private helpers.
    /^impl.*Private.*Helpers/,/^\}$/ {
        s/^impl<'a> Private([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for &'a ([^ ]+) \{$/impl \3 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

    # Patch public helpers.
    /^impl.*Helpers/,/^\}$/ {
        s/^impl(<'a>)? ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for (&'a )?([^ ]+) \{$/impl \5 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn .*\(&?self[,)]/s/(unsafe )?fn/pub &/
        /^ *pub (unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

The few error cases were then fixed by hand.
2015-08-27 16:59:02 +02:00
João Oliveira
fd87c8cb3e make dom_struct derive HeapSizeOf,
closes #7357
2015-08-27 01:17:48 +01:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
Bogdan Cuza
45145108da Measure heap memory usage for more types. Fixes #6951 2015-08-13 21:44:41 +03:00
Brandon Fairchild
a95015b68a Rename SendConsoleMessage to ConsoleAPI
Fixes #7131.
2015-08-10 16:46:18 -04:00