Closed Bug 738380 Opened 13 years ago Closed 13 years ago

Remove nsINode::GetScriptTypeID/SetScriptTypeID

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla14

People

(Reporter: Ms2ger, Assigned: capella)

References

Details

(Whiteboard: [good first bug][mentor=Ms2ger][lang=c++])

Attachments

(3 files, 4 obsolete files)

AFAICT, GetScriptTypeID will always end up returning nsIProgrammingLanguage::JAVASCRIPT. It would be good to remove the API, and the NODE_SCRIPT_TYPE_OFFSET / NODE_SCRIPT_TYPE_MASK stuff.
Assignee: nobody → markcapella
Status: NEW → ASSIGNED
Attached patch Patch (v1) (obsolete) — Splinter Review
I went through and made what I thought were the required changes to get rid off GetScriptTypeID / SetScriptTypeID() as the first part of this bug request. It builds nice and clean but crashes during startup. If I monitor the WIN Task Manager I see WERFAULT.EXE doing something briefly ... so I guess I'm getting a >cool< abend somewhere ... I did take some liberties during the coding of the changes, particularly in my substitutions where I do things like this: - nsCOMPtr<nsIScriptContext> scx = GetScriptContextInternal( - timeout->mScriptHandler->GetScriptTypeID()); + nsCOMPtr<nsIScriptContext> scx = + GetScriptContextInternal(nsIProgrammingLanguage::JAVASCRIPT); So I have a few things to go on ...
Attachment #608978 - Flags: feedback?(Ms2ger)
Comment on attachment 608978 [details] [diff] [review] Patch (v1) Clobber build fixed the "problem" ... I'm cancelling the feedback request and moving on to the final part of the bug request.
Attachment #608978 - Flags: feedback?(Ms2ger)
Attached patch Patch (v2) (obsolete) — Splinter Review
K - this should do it :) Let me know if we can go forward with this, but the build was clean, FF runs w/no weird abends, mochitest-a11y runs w/no errors, mochitest-plain gives me the usual 9 suspects but nothing new ...
Attachment #608978 - Attachment is obsolete: true
Attachment #609054 - Flags: feedback?(Ms2ger)
Comment on attachment 609054 [details] [diff] [review] Patch (v2) Review of attachment 609054 [details] [diff] [review]: ----------------------------------------------------------------- Just a few minor comments; thanks for doing this! ::: content/base/src/nsDocument.cpp @@ -3112,5 @@ > rv = NS_GetScriptRuntime(aData, getter_AddRefs(runtime)); > if (NS_FAILED(rv) || runtime == nsnull) { > NS_WARNING("The script-type is unknown"); > - } else { > - root->SetScriptTypeID(runtime->GetScriptTypeID()); I think this entire block can go now ::: content/base/src/nsScriptLoader.cpp @@ +920,5 @@ > mCurrentScript = oldCurrent; > > JSContext *cx = nsnull; // Initialize this to keep GCC happy. > + cx = context->GetNativeContext(); > + ::JS_BeginRequest(cx); This can use JSAutoRequest now ::: content/events/src/nsEventListenerManager.cpp @@ +994,5 @@ > + if (ls->mHandlerIsString) { > + CompileEventHandlerInternal(ls, true, nsnull); > + } > + > + *vp = OBJECT_TO_JSVAL(listener->GetHandler()); Did something go wrong with the indentation here? ::: content/xul/document/src/nsXULDocument.cpp @@ +3912,5 @@ > > // While merging, set the default script language of the element to be > // the language from the overlay - attributes will then be correctly > // hooked up with the appropriate language (while child nodes ignore > // the default language - they have it in their proto. This comment can go too ::: dom/base/nsGlobalWindow.cpp @@ +9379,5 @@ > > // Get the script context (a strong ref to prevent it going away) > // for this timeout and ensure the script language is enabled. > + nsCOMPtr<nsIScriptContext> scx = > + GetScriptContextInternal(nsIProgrammingLanguage::JAVASCRIPT); GetContextInternal(), I think
Attachment #609054 - Flags: feedback?(Ms2ger) → feedback+
::: content/base/src/nsDocument.cpp I think this entire block can go now >>> Easy enough, gone. ::: content/base/src/nsScriptLoader.cpp This can use JSAutoRequest now >>> Researching ... ::: content/events/src/nsEventListenerManager.cpp Did something go wrong with the indentation here? >>> Looks like it ... I don't recall, but it's now fixed. ::: content/xul/document/src/nsXULDocument.cpp This comment can go too >>> Easy enough, gone. ::: dom/base/nsGlobalWindow.cpp @@ +9379,5 @@ > + nsCOMPtr<nsIScriptContext> scx = > + GetScriptContextInternal(nsIProgrammingLanguage::JAVASCRIPT); GetContextInternal(), I think >>> The original code was this. I can change, but researching ... >>>- nsCOMPtr<nsIScriptContext> scx = GetScriptContextInternal( >>>- timeout->mScriptHandler->GetScriptTypeID());
Attached patch Patch (v3) (obsolete) — Splinter Review
I made the (5) changes, two cosmetic, three code... the new version builds and tests ok still, but please verify the code changes for correctness.
Attachment #609054 - Attachment is obsolete: true
Attachment #609153 - Flags: feedback?(Ms2ger)
Comment on attachment 609153 [details] [diff] [review] Patch (v3) Review of attachment 609153 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, except for this one comment: ::: content/base/src/nsScriptLoader.cpp @@ -930,5 @@ > - NS_ASSERTION(!::JS_IsExceptionPending(cx), > - "JS_ReportPendingException wasn't called in EvaluateString"); > - } > - > - context->SetProcessingScriptTag(oldProcessingScriptTag); You seem to be removing this call; it should stay (after the JSAutoRequest).
Attachment #609153 - Flags: feedback?(Ms2ger) → feedback+
great! I was wondering... it was sandwiched between the Start and End in the original code... wasn't sure to drop it or move it logically to the end
Attached patch Patch (v4) (obsolete) — Splinter Review
Plays it safe, re-codes, re-compiles all, mochitest-plain all pass ...
Attachment #609153 - Attachment is obsolete: true
Attachment #609165 - Flags: feedback?(Ms2ger)
Attachment #609165 - Flags: feedback?(Ms2ger) → feedback+
Attachment #609165 - Flags: review?(jst)
Comment on attachment 609165 [details] [diff] [review] Patch (v4) class nsIScriptContext : public nsIScriptContextPrincipal { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTCONTEXT_IID) - /* Get the ID of this language. */ - virtual PRUint32 GetScriptTypeID() = 0; You're removing a virtual function here, that means you have to generate a new uuid for this interface (NS_ISCRIPTCONTEXT_IID). class nsIScriptRuntime : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTRUNTIME_IID) - /* - * Return the language ID of this script language - */ - virtual PRUint32 GetScriptTypeID() = 0; Same thing here, generate a new uuid for this interface as well. class nsIScriptTimeoutHandler : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTTIMEOUTHANDLER_IID) - // Get the script-type (language) implementing this timeout. - virtual PRUint32 GetScriptTypeID() = 0; And here. r- based on that alone, the rest looks great! Thanks for the cleanup patch!
Attachment #609165 - Flags: review?(jst) → review-
Attached patch Patch (v5)Splinter Review
Created and added new _IID 's
Attachment #609165 - Attachment is obsolete: true
Attachment #609602 - Flags: review?(jst)
Comment on attachment 609602 [details] [diff] [review] Patch (v5) Looks good! But I forgot to include nsINode in the list of interfaces that need a new UUID. Fix that, and this can land!
Attachment #609602 - Flags: review?(jst) → review+
Attached patch Patch (v6)Splinter Review
nsINode UUID added...
Comment on attachment 609934 [details] [diff] [review] Patch (v6) Good to go?
Attachment #609934 - Flags: checkin?(jst)
Comment on attachment 609934 [details] [diff] [review] Patch (v6) I went to land this, but a bunch of other changes that touch some of this other code happened to land in the past several days, so this no longer applies :( I don't imagine it'd be a ton of work to update this to apply any more, and I'll gladly land a new patch, or maybe even update this myself if nobody else beats me to it.
Attachment #609934 - Flags: checkin?(jst) → checkin-
I'll rebase it this weekend and re-post it.
Attached patch Patch (v7)Splinter Review
Re-based, re-built, re-tested all mochitest-plain local.
Whiteboard: [good first bug][mentor=Ms2ger][lang=c++] → [autoland-try:611253][good first bug][mentor=Ms2ger][lang=c++]
Whiteboard: [autoland-try:611253][good first bug][mentor=Ms2ger][lang=c++] → [autoland-in-queue][good first bug][mentor=Ms2ger][lang=c++]
Autoland Patchset: Patches: 611253 Branch: mozilla-central => try Destination: http://hg.mozilla.org/try/pushloghtml?changeset=dcabacec61aa Try run started, revision dcabacec61aa. To cancel or monitor the job, see: https://tbpl.mozilla.org/?tree=Try&rev=dcabacec61aa
Try run for dcabacec61aa is complete. Detailed breakdown of the results available here: https://tbpl.mozilla.org/?tree=Try&rev=dcabacec61aa Results (out of 15 total builds): success: 15 Builds (or logs if builds failed) available at: http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/autolanduser@mozilla.com-dcabacec61aa
Whiteboard: [autoland-in-queue][good first bug][mentor=Ms2ger][lang=c++] → [good first bug][mentor=Ms2ger][lang=c++]
Try run looked good, so I pushed to inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/3eee3ceb400b
Target Milestone: --- → mozilla14
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Hey, this is pretty cool! I think it will let me tear out a bunch of gunk from the cycle collector.
Blocks: 744103
Depends on: 762182
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: